gtk3-0.15.10: Binding to the Gtk+ 3 graphical user interface library

Maintainer | gtk2hs-users@lists.sourceforge.net
Stability | provisional
Portability | portable (depends on GHC)
Safe Haskell | None
Language | Haskell98

Graphics.UI.Gtk.Buttons.Button

Contents

- Detail
- Class Hierarchy
- Types
- Constructors
- Methods
- Attributes
- Signals
- Deprecated

Description

A widget that creates a signal when clicked on

Synopsis

- data Button
- class BinClass o => ButtonClass o
- castToButton :: GObjectClass obj => obj -> Button
- gTypeButton :: GType
- toButton :: ButtonClass o => o -> Button
- buttonNew :: IO Button
- buttonNewWithLabel :: GlibString string => string -> IO Button
- buttonNewWithMnemonic :: GlibString string => string -> IO Button
- buttonNewFromStock :: StockId -> IO Button
- buttonPressed :: ButtonClass self => self -> IO ()
- buttonReleased :: ButtonClass self => self -> IO ()
- buttonClicked :: ButtonClass self => self -> IO ()
- buttonEnter :: ButtonClass self => self -> IO ()
- buttonLeave :: ButtonClass self => self -> IO ()
- data ReliefStyle
  - = ReliefNormal
  - | ReliefHalf
  - | ReliefNone
- buttonSetRelief :: ButtonClass self => self -> ReliefStyle -> IO ()
- buttonGetRelief :: ButtonClass self => self -> IO ReliefStyle
- buttonSetLabel :: (ButtonClass self, GlibString string) => self -> string -> IO ()
- buttonGetLabel :: (ButtonClass self, GlibString string) => self -> IO string
- buttonSetUseStock :: ButtonClass self => self -> Bool -> IO ()
- buttonGetUseStock :: ButtonClass self => self -> IO Bool
- buttonSetUseUnderline :: ButtonClass self => self -> Bool -> IO ()
- buttonGetUseUnderline :: ButtonClass self => self -> IO Bool
- buttonSetFocusOnClick :: ButtonClass self => self -> Bool -> IO ()
- buttonGetFocusOnClick :: ButtonClass self => self -> IO Bool
- buttonSetAlignment :: ButtonClass self => self -> (Float, Float) -> IO ()
- buttonGetAlignment :: ButtonClass self => self -> IO (Float, Float)
- buttonGetImage :: ButtonClass self => self -> IO (Maybe Widget)
- buttonSetImage :: (ButtonClass self, WidgetClass image) => self -> image -> IO ()
- data PositionType
  - = PosLeft
  - | PosRight
  - | PosTop
  - | PosBottom
- buttonSetImagePosition :: ButtonClass self => self -> PositionType -> IO ()
- buttonGetImagePosition :: ButtonClass self => self -> IO PositionType
- buttonGetEventWindow :: ButtonClass self => self -> IO (Maybe DrawWindow)
- buttonLabel :: (ButtonClass self, GlibString string) => Attr self string
- buttonUseUnderline :: ButtonClass self => Attr self Bool
- buttonUseStock :: ButtonClass self => Attr self Bool
- buttonFocusOnClick :: ButtonClass self => Attr self Bool
- buttonRelief :: ButtonClass self => Attr self ReliefStyle
- buttonXalign :: ButtonClass self => Attr self Float
- buttonYalign :: ButtonClass self => Attr self Float
- buttonImage :: (ButtonClass self, WidgetClass image) => ReadWriteAttr self (Maybe Widget) image
- buttonImagePosition :: ButtonClass self => Attr self PositionType
- buttonActivated :: ButtonClass self => Signal self (IO ())

# Detail

The `Button` widget is generally used to attach a function to 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 most any other standard `Widget`. The most commonly used child is the `Label`.

# Class Hierarchy

    | GObject
    | +----Object
    | +----Widget
    | +----Container
    | +----Bin
    | +----Button
    | +----ToggleButton
    | +----ColorButton
    | +----FontButton
    | +----OptionMenu

# Types

data Button Source #

#### Instances

Instances details

Eq Button Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods (==) :: Button -> Button -> Bool Source # (/=) :: Button -> Button -> Bool Source #
Ord Button Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods compare :: Button -> Button -> Ordering Source # (<) :: Button -> Button -> Bool Source # (<=) :: Button -> Button -> Bool Source # (>) :: Button -> Button -> Bool Source # (>=) :: Button -> Button -> Bool Source # max :: Button -> Button -> Button Source # min :: Button -> Button -> Button Source #
GObjectClass Button Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods toGObject :: Button -> GObject Source # unsafeCastGObject :: GObject -> Button Source #
BinClass Button Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ButtonClass Button Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ContainerClass Button Source # |
Instance details Defined in Graphics.UI.Gtk.Types
WidgetClass Button Source # |
Instance details Defined in Graphics.UI.Gtk.Types

class BinClass o => ButtonClass o Source #

#### Instances

Instances details

ButtonClass Button Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ButtonClass CheckButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ButtonClass ColorButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ButtonClass FontButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ButtonClass LinkButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ButtonClass RadioButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ButtonClass ScaleButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ButtonClass ToggleButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ButtonClass VolumeButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types

castToButton :: GObjectClass obj => obj -> Button Source #

gTypeButton :: GType Source #

toButton :: ButtonClass o => o -> Button Source #

# Constructors

buttonNew :: IO Button Source #

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

buttonNewWithLabel Source #

Arguments

:: GlibString string |
=> string | `label` - The text you want the `Label` to hold.
-> IO Button |

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

buttonNewWithMnemonic Source #

Arguments

:: GlibString string |
=> string | `label` - The text of the button, with an underscore in front of the mnemonic character
-> IO 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.

buttonNewFromStock Source #

Arguments

:: StockId | `stockId` - the name of the stock item
-> IO Button |

Creates a new `Button` containing the image and text from a stock item.

If `stockId` is unknown, then it will be treated as a mnemonic label (as for `buttonNewWithMnemonic`).

# Methods

buttonPressed :: ButtonClass self => self -> IO () Source #

Emits the button pressed signal for the given `Button`.

buttonReleased :: ButtonClass self => self -> IO () Source #

Emits the button released signal for the given `Button`.

buttonClicked :: ButtonClass self => self -> IO () Source #

Emits the button clicked signal for the given `Button`.

This is similar to calling `buttonPressed` and `buttonReleased` in sequence.

buttonEnter :: ButtonClass self => self -> IO () Source #

Emit the cursor enters signal to the button.

buttonLeave :: ButtonClass self => self -> IO () Source #

Emit the cursor leaves signal to the button.

data ReliefStyle Source #

I don't have a clue.

Constructors

ReliefNormal |
ReliefHalf |
ReliefNone |

#### Instances

Instances details

Enum ReliefStyle Source # |

Instance details

Defined in Graphics.UI.Gtk.General.Enums

Methods

succ :: ReliefStyle -> ReliefStyle Source #

pred :: ReliefStyle -> ReliefStyle Source #

toEnum :: Int -> ReliefStyle Source #

fromEnum :: ReliefStyle -> Int Source #

enumFrom :: ReliefStyle -> [ReliefStyle] Source #

enumFromThen :: ReliefStyle -> ReliefStyle -> [ReliefStyle] Source #

enumFromTo :: ReliefStyle -> ReliefStyle -> [ReliefStyle] Source #

enumFromThenTo :: ReliefStyle -> ReliefStyle -> ReliefStyle -> [ReliefStyle] Source #

Show ReliefStyle Source # |
Instance details Defined in Graphics.UI.Gtk.General.Enums Methods showsPrec :: Int -> ReliefStyle -> ShowS Source # show :: ReliefStyle -> String Source # showList :: [ReliefStyle] -> ShowS Source #
Eq ReliefStyle Source # |
Instance details Defined in Graphics.UI.Gtk.General.Enums Methods (==) :: ReliefStyle -> ReliefStyle -> Bool Source # (/=) :: ReliefStyle -> ReliefStyle -> Bool Source #

buttonSetRelief Source #

Arguments

:: ButtonClass self |
=> self |
-> ReliefStyle | `newstyle` - The `ReliefStyle` as described above.
-> IO () |

Sets the relief style of the edges of the given `Button` widget. Three styles exist, `ReliefNormal`, `ReliefHalf`, `ReliefNone`. The default style is, as one can guess, `ReliefNormal`.

buttonGetRelief Source #

Arguments

:: ButtonClass self |
=> self |
-> IO ReliefStyle | returns The current `ReliefStyle`

Returns the current relief style of the given `Button`.

buttonSetLabel :: (ButtonClass self, GlibString string) => self -> string -> IO () Source #

Sets the text of the label of the button. This text is also used to select the stock item if `buttonSetUseStock` is used.

This will also clear any previously set labels.

buttonGetLabel :: (ButtonClass self, GlibString string) => self -> IO string Source #

Gets 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 `""`. This will be the case if you create an empty button with `buttonNew` to use as a container.

buttonSetUseStock Source #

Arguments

:: ButtonClass self |
=> self |
-> Bool | `useStock` - `True` if the button should use a stock item
-> IO () |

If true, the label set on the button is used as a stock id to select the stock item for the button.

Setting this property to `True` will make the button lookup its label in the table of stock items. If there is a match, the button will use the stock item instead of the label. You need to set this flag before you change the label.

buttonGetUseStock Source #

Arguments

:: ButtonClass self |
=> self |
-> IO Bool | returns `True` if the button label is used to select a stock item instead of being used directly as the label text.

Returns whether the button label is a stock item.

buttonSetUseUnderline Source #

Arguments

:: ButtonClass self |
=> self |
-> Bool | `useUnderline` - `True` if underlines in the text indicate mnemonics
-> IO () |

If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.

Setting this property will make the button join any underline character into the following letter and inserting this letter as a keyboard shortcut. You need to set this flag before you change the label.

buttonGetUseUnderline Source #

Arguments

:: ButtonClass self |
=> self |
-> IO 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 `buttonSetUseUnderline`.

buttonSetFocusOnClick Source #

Arguments

:: ButtonClass self |
=> self |
-> Bool | `focusOnClick` - whether the button grabs focus when clicked with the mouse
-> IO () |

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.

- Available since Gtk version 2.4

buttonGetFocusOnClick Source #

Arguments

:: ButtonClass self |
=> self |
-> IO Bool | returns `True` if the button grabs focus when it is clicked with the mouse.

Returns whether the button grabs focus when it is clicked with the mouse. See `buttonSetFocusOnClick`.

- Available since Gtk version 2.4

buttonSetAlignment Source #

Arguments

:: ButtonClass self |
=> self |
-> (Float, Float) | `(xalign, yalign)` - the horizontal position of the child (0.0 is left aligned, 1.0 is right aligned) and the vertical position of the child (0.0 is top aligned, 1.0 is bottom aligned)
-> IO () |

Sets the alignment of the child. This has no effect unless the child derives from `Misc` or `Alignment`.

- Available since Gtk version 2.4

buttonGetAlignment Source #

Arguments

:: ButtonClass self |
=> self |
-> IO (Float, Float) | `(xalign, yalign)` - horizontal and vertical alignment

Gets the alignment of the child in the button.

- Available since Gtk version 2.4

buttonGetImage Source #

Arguments

:: ButtonClass self |
=> self |
-> IO (Maybe Widget) | a `Widget` or `Nothing` in case there is no image

Gets the widget that is currently set as the image of the button. This may have been explicitly set by `buttonSetImage` or constructed by `buttonNewFromStock`.

- Available since Gtk+ version 2.6

buttonSetImage Source #

Arguments

:: (ButtonClass self, WidgetClass image) |
=> self |
-> image | a widget to set as the image for the button
-> IO () |

Set the image of the button to the given widget. Note that it depends on the "gtk-button-images" setting whether the image will be displayed or not.

- Available since Gtk+ version 2.6

data PositionType Source #

Position a scale's value is drawn relative to the through

Constructors

PosLeft |
PosRight |
PosTop |
PosBottom |

#### Instances

Instances details

Enum PositionType Source # |

Instance details

Defined in Graphics.UI.Gtk.General.Enums

Methods

succ :: PositionType -> PositionType Source #

pred :: PositionType -> PositionType Source #

toEnum :: Int -> PositionType Source #

fromEnum :: PositionType -> Int Source #

enumFrom :: PositionType -> [PositionType] Source #

enumFromThen :: PositionType -> PositionType -> [PositionType] Source #

enumFromTo :: PositionType -> PositionType -> [PositionType] Source #

enumFromThenTo :: PositionType -> PositionType -> PositionType -> [PositionType] Source #

Show PositionType Source # |
Instance details Defined in Graphics.UI.Gtk.General.Enums Methods showsPrec :: Int -> PositionType -> ShowS Source # show :: PositionType -> String Source # showList :: [PositionType] -> ShowS Source #
Eq PositionType Source # |
Instance details Defined in Graphics.UI.Gtk.General.Enums Methods (==) :: PositionType -> PositionType -> Bool Source # (/=) :: PositionType -> PositionType -> Bool Source #

buttonSetImagePosition Source #

Arguments

:: ButtonClass self |
=> self |
-> PositionType | `position` - the position
-> IO () |

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

- Available since Gtk+ version 2.10

buttonGetImagePosition Source #

Arguments

:: ButtonClass self |
=> self |
-> IO PositionType | returns the position

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

- Available since Gtk+ version 2.10

buttonGetEventWindow Source #

Arguments

:: ButtonClass self |
=> self |
-> IO (Maybe DrawWindow) | returns button's event window or `Nothing`

Returns the button's event window if it is realized, `Nothing` otherwise.

- Available since Gtk+ version 2.22

# Attributes

buttonLabel :: (ButtonClass self, GlibString string) => Attr self string Source #

Text of the label widget inside the button, if the button contains a label widget.

Default value: `""`

buttonUseUnderline :: ButtonClass self => Attr self Bool Source #

If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.

Default value: `False`

buttonUseStock :: ButtonClass self => Attr self Bool Source #

If set, the label is used to pick a stock item instead of being displayed.

Default value: `False`

buttonFocusOnClick :: ButtonClass self => Attr self Bool Source #

Whether the button grabs focus when it is clicked with the mouse.

Default value: `True`

buttonRelief :: ButtonClass self => Attr self ReliefStyle Source #

The border relief style.

Default value: `ReliefNormal`

buttonXalign :: ButtonClass self => Attr self Float Source #

If the child of the button is a `Misc` or `Alignment`, this property can be used to control it's horizontal alignment. 0.0 is left aligned, 1.0 is right aligned.

Allowed values: [0,1]

Default value: 0.5

buttonYalign :: ButtonClass self => Attr self Float Source #

If the child of the button is a `Misc` or `Alignment`, this property can be used to control it's vertical alignment. 0.0 is top aligned, 1.0 is bottom aligned.

Allowed values: [0,1]

Default value: 0.5

buttonImage :: (ButtonClass self, WidgetClass image) => ReadWriteAttr self (Maybe Widget) image Source #

Child widget to appear next to the button text.

- Available since Gtk version 2.6

buttonImagePosition :: ButtonClass self => Attr self PositionType Source #

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

Default value: `PosLeft`

- Available since Gtk+ version 2.10

# Signals

buttonActivated :: ButtonClass self => Signal self (IO ()) Source #

Emitted when the button has been activated (pressed and released).

# Deprecated