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

Contents

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

Description

A choice from multiple check buttons

Synopsis

- data RadioButton
- class CheckButtonClass o => RadioButtonClass o
- castToRadioButton :: GObjectClass obj => obj -> RadioButton
- gTypeRadioButton :: GType
- toRadioButton :: RadioButtonClass o => o -> RadioButton
- radioButtonNew :: IO RadioButton
- radioButtonNewWithLabel :: GlibString string => string -> IO RadioButton
- radioButtonNewWithMnemonic :: GlibString string => string -> IO RadioButton
- radioButtonNewFromWidget :: RadioButton -> IO RadioButton
- radioButtonNewWithLabelFromWidget :: GlibString string => RadioButton -> string -> IO RadioButton
- radioButtonNewWithMnemonicFromWidget :: GlibString string => RadioButton -> string -> IO RadioButton
- radioButtonNewJoinGroup :: RadioButton -> IO RadioButton
- radioButtonNewJoinGroupWithLabel :: GlibString string => RadioButton -> string -> IO RadioButton
- radioButtonNewJoinGroupWithMnemonic :: GlibString string => RadioButton -> string -> IO RadioButton
- radioButtonSetGroup :: RadioButton -> RadioButton -> IO ()
- radioButtonGetGroup :: RadioButton -> IO [RadioButton]
- radioButtonGroup :: ReadWriteAttr RadioButton [RadioButton] RadioButton
- groupChanged :: RadioButtonClass self => Signal self (IO ())

# Detail

A single radio button performs the same basic function as a `CheckButton`, as its position in the object hierarchy reflects. It is only when multiple radio buttons are grouped together that they become a different user interface component in their own right.

Every radio button is a member of some group of radio buttons. When one is selected, all other radio buttons in the same group are deselected. A `RadioButton` is one way of giving the user a choice from many options.

Radio button widgets are created with `radioButtonNew`. Optionally, `radioButtonNewWithLabel` can be used if you want a text label on the radio button.

For the radio button functions that take an existing group, the groups are represented by any of their members. So when adding widgets to an existing group of radio buttons, use `radioButtonNewFromWidget` with a `RadioButton` that is already a member of the group. The convenience function `radioButtonNewWithLabelFromWidget` is also provided.

To remove a `RadioButton` from one group and make it part of a new one, use `radioButtonSetGroup`.

- How to create a group of two radio buttons.

    createRadioButtons :: IO ()
    createRadioButtons = do
    window <- windowNew
    box <- vBoxNew True 2

    -- Create a radio button with a Entry widget
    radio1 <- radioButtonNew
    entry <- entryNew
    containerAdd radio1 entry

    -- Create a radio button with a label
    radio2 <- radioButtonNewWithLabelFromWidget
    radio1 "I'm the second radio button."

    -- Pack them into a box, then show all the widgets
    boxPackStart box radio1 PackGrow 2
    boxPackStart box radio2 PackGrow 2
    containerAdd window box
    widgetShowAll window

When an unselected button in the group is clicked the clicked button receives the "toggled" signal, as does the previously selected button. Inside the "toggled" handler, `toggleButtonGetActive` can be used to determine if the button has been selected or deselected.

# Class Hierarchy

    | GObject
    | +----Object
    | +----Widget
    | +----Container
    | +----Bin
    | +----Button
    | +----ToggleButton
    | +----CheckButton
    | +----RadioButton

# Types

data RadioButton Source #

#### Instances

Instances details

Eq RadioButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods (==) :: RadioButton -> RadioButton -> Bool Source # (/=) :: RadioButton -> RadioButton -> Bool Source #
Ord RadioButton Source # |

Instance details

Defined in Graphics.UI.Gtk.Types

Methods

compare :: RadioButton -> RadioButton -> Ordering Source #

(<) :: RadioButton -> RadioButton -> Bool Source #

(<=) :: RadioButton -> RadioButton -> Bool Source #

(>) :: RadioButton -> RadioButton -> Bool Source #

(>=) :: RadioButton -> RadioButton -> Bool Source #

max :: RadioButton -> RadioButton -> RadioButton Source #

min :: RadioButton -> RadioButton -> RadioButton Source #

GObjectClass RadioButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods toGObject :: RadioButton -> GObject Source # unsafeCastGObject :: GObject -> RadioButton Source #
BinClass RadioButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ButtonClass RadioButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
CheckButtonClass RadioButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ContainerClass RadioButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
RadioButtonClass RadioButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
ToggleButtonClass RadioButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
WidgetClass RadioButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types

class CheckButtonClass o => RadioButtonClass o Source #

#### Instances

Instances details

RadioButtonClass RadioButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types

castToRadioButton :: GObjectClass obj => obj -> RadioButton Source #

gTypeRadioButton :: GType Source #

toRadioButton :: RadioButtonClass o => o -> RadioButton Source #

# Constructors

radioButtonNew :: IO RadioButton Source #

Creates a new `RadioButton` with a new group. To be of any practical value, a widget should then be packed into the radio button.

radioButtonNewWithLabel :: GlibString string => string -> IO RadioButton Source #

Creates a new `RadioButton` with a text label.

radioButtonNewWithMnemonic Source #

Arguments

:: GlibString string |
=> string | `label` - the text of the button, with an underscore in front of the mnemonic character
-> IO RadioButton |

Creates a new `RadioButton` containing a label. The label will be created using `labelNewWithMnemonic`, so underscores in `label` indicate the mnemonic for the button.

radioButtonNewFromWidget Source #

Arguments

:: RadioButton | `groupMember` - a member of an existing radio button group, to which the new radio button will be added.
-> IO RadioButton |

Creates a new `RadioButton`, adding it to the same group as the group to which `groupMember` belongs. As with `radioButtonNew`, a widget should be packed into the radio button.

radioButtonNewWithLabelFromWidget Source #

Arguments

:: GlibString string |
=> RadioButton | `groupMember` - a member of an existing radio button group, to which the new radio button will be added.
-> string | `label` - a text string to display next to the radio button.
-> IO RadioButton |

Creates a new `RadioButton` with a text label, adding it to the same group as the group to which `groupMember` belongs.

radioButtonNewWithMnemonicFromWidget Source #

Arguments

:: GlibString string |
=> RadioButton | `groupMember` - a member of an existing radio button group, to which the new radio button will be added.
-> string | `label` - the text of the button, with an underscore in front of the mnemonic character
-> IO RadioButton |

Creates a new `RadioButton` containing a label, adding it to the same group as the group to which `groupMember` belongs. The label will be created using `labelNewWithMnemonic`, so underscores in `label` indicate the mnemonic for the button.

# Compatibility aliases

radioButtonNewJoinGroup Source #

Arguments

:: RadioButton | `groupMember` - a member of an existing radio button group, to which the new radio button will be added.
-> IO RadioButton |

Deprecated: use radioButtonNewFromWidget instead

Alias for `radioButtonNewFromWidget`.

radioButtonNewJoinGroupWithLabel Source #

Arguments

:: GlibString string |
=> RadioButton | `groupMember` - a member of an existing radio button group, to which the new radio button will be added.
-> string | `label` - a text string to display next to the radio button.
-> IO RadioButton |

Deprecated: use radioButtonNewWithLabelFromWidget instead

Alias for `radioButtonNewWithLabelFromWidget`.

radioButtonNewJoinGroupWithMnemonic Source #

Arguments

:: GlibString string |
=> RadioButton | `groupMember` - a member of an existing radio button group, to which the new radio button will be added.
-> string | `label` - the text of the button, with an underscore in front of the mnemonic character
-> IO RadioButton |

Deprecated: use radioButtonNewWithMnemonicFromWidget instead

Alias for `radioButtonNewWithMnemonicFromWidget`.

# Methods

radioButtonSetGroup Source #

Arguments

:: RadioButton |
-> RadioButton | `groupMember` - a member of an existing radio button group, to which this radio button will be added.
-> IO () |

Sets a `RadioButton`s group. It should be noted that this does not change the layout of your interface in any way, so if you are changing the group, it is likely you will need to re-arrange the user interface to reflect these changes.

radioButtonGetGroup Source #

Arguments

:: RadioButton |
-> IO [RadioButton] | returns a list containing all the radio buttons in the same group as this radio button.

Retrieves the group assigned to a radio button.

# Attributes

radioButtonGroup :: ReadWriteAttr RadioButton [RadioButton] RadioButton Source #

Sets a new group for a radio button.

# Signals

groupChanged :: RadioButtonClass self => Signal self (IO ()) Source #

Emitted when the group of radio buttons that a radio button belongs to changes. This is emitted when a radio button switches from being alone to being part of a group of 2 or more buttons, or vice-versa, and when a button is moved from one group of 2 or more buttons to a different one, but not when the composition of the group that a button belongs to changes.

- Available since Gtk+ version 2.4

# Deprecated