gtk-0.12.0: Binding to the Gtk+ graphical user interface library.

Portability | portable (depends on GHC)
Stability | provisional
Maintainer | gtk2hs-users@lists.sourceforge.net

Graphics.UI.Gtk.Buttons.ToggleButton

Contents

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

Description

Create buttons which retain their state

Synopsis

- data ToggleButton
- class ButtonClass o => ToggleButtonClass o
- castToToggleButton :: GObjectClass obj => obj -> ToggleButton
- gTypeToggleButton :: GType
- toToggleButton :: ToggleButtonClass o => o -> ToggleButton
- toggleButtonNew :: IO ToggleButton
- toggleButtonNewWithLabel :: String -> IO ToggleButton
- toggleButtonNewWithMnemonic :: String -> IO ToggleButton
- toggleButtonSetMode :: ToggleButtonClass self => self -> Bool -> IO ()
- toggleButtonGetMode :: ToggleButtonClass self => self -> IO Bool
- toggleButtonToggled :: ToggleButtonClass self => self -> IO ()
- toggleButtonGetActive :: ToggleButtonClass self => self -> IO Bool
- toggleButtonSetActive :: ToggleButtonClass self => self -> Bool -> IO ()
- toggleButtonGetInconsistent :: ToggleButtonClass self => self -> IO Bool
- toggleButtonSetInconsistent :: ToggleButtonClass self => self -> Bool -> IO ()
- toggleButtonActive :: ToggleButtonClass self => Attr self Bool
- toggleButtonInconsistent :: ToggleButtonClass self => Attr self Bool
- toggleButtonDrawIndicator :: ToggleButtonClass self => Attr self Bool
- toggleButtonMode :: ToggleButtonClass self => Attr self Bool
- toggled :: ToggleButtonClass self => Signal self (IO ())
- onToggled :: ToggleButtonClass self => self -> IO () -> IO (ConnectId self)
- afterToggled :: ToggleButtonClass self => self -> IO () -> IO (ConnectId self)

# Detail

A `ToggleButton` is a `Button` which will remain 'pressed-in' when clicked. Clicking again will cause the toggle button to return to its normal state.

A toggle button is created by calling either `toggleButtonNew` or `toggleButtonNewWithLabel`. If using the former, it is advisable to pack a widget, (such as a `Label` and/or a `Pixmap`), into the toggle button's container. (See `Button` for more information).

The state of a `ToggleButton` can be set specifically using `toggleButtonSetActive`, and retrieved using `toggleButtonGetActive`.

To simply switch the state of a toggle button, use `toggleButtonToggled`.

# Class Hierarchy

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

# Types

data ToggleButton

Instances

Eq ToggleButton |
Ord ToggleButton |
GObjectClass ToggleButton |
ToggleButtonClass ToggleButton |
ButtonClass ToggleButton |
BinClass ToggleButton |
ContainerClass ToggleButton |
WidgetClass ToggleButton |
ObjectClass ToggleButton |

class ButtonClass o => ToggleButtonClass o

Instances

ToggleButtonClass RadioButton |
ToggleButtonClass CheckButton |
ToggleButtonClass ToggleButton |

castToToggleButton :: GObjectClass obj => obj -> ToggleButton

gTypeToggleButton :: GType

toToggleButton :: ToggleButtonClass o => o -> ToggleButton

# Constructors

toggleButtonNew :: IO ToggleButton

Creates a new toggle button. A widget should be packed into the button, as in `Graphics.UI.Gtk.Buttons.Button.buttonNew`.

toggleButtonNewWithLabel

Arguments

:: String | `label` - a string containing the message to be placed in the toggle button.
-> IO ToggleButton |

Creates a new toggle button with a text label.

toggleButtonNewWithMnemonic

Arguments

:: String | `label` - the text of the button, with an underscore in front of the mnemonic character
-> IO ToggleButton |

Creates a new `ToggleButton` containing a label. The label will be created using `Graphics.UI.Gtk.Display.Label.labelNewWithMnemonic`, so underscores in `label` indicate the mnemonic for the button.

# Methods

toggleButtonSetMode

Arguments

:: ToggleButtonClass self |
=> self |
-> Bool | `drawIndicator` - if `True`, draw the button as a separate indicator and label; if `False`, draw the button like a normal button
-> IO () |

Sets whether the button is displayed as a separate indicator and label. You can call this function on a `CheckButton` or a `RadioButton` with `False` to make the button look like a normal button.

This function only affects instances of classes like `CheckButton` and `RadioButton` that derive from `ToggleButton`, not instances of `ToggleButton` itself.

toggleButtonGetMode

Arguments

:: ToggleButtonClass self |
=> self |
-> IO Bool | returns `True` if the togglebutton is drawn as a separate indicator and label.

Retrieves whether the button is displayed as a separate indicator and label. See `toggleButtonSetMode`.

toggleButtonToggled :: ToggleButtonClass self => self -> IO ()

Emits the toggled signal on the `ToggleButton`. There is no good reason for an application ever to call this function.

toggleButtonGetActive :: ToggleButtonClass self => self -> IO Bool

Queries a `ToggleButton` and returns its current state. Returns `True` if the toggle button is pressed in and `False` if it is raised.

toggleButtonSetActive

Arguments

:: ToggleButtonClass self |
=> self |
-> Bool | `isActive` - `True` or `False`.
-> IO () |

Sets the status of the toggle button. Set to `True` if you want the `ToggleButton` to be 'pressed in', and `False` to raise it. This action causes the toggled signal to be emitted.

toggleButtonGetInconsistent

Arguments

:: ToggleButtonClass self |
=> self |
-> IO Bool | returns `True` if the button is displayed as inconsistent, `False` otherwise

Gets the value set by `toggleButtonSetInconsistent`.

toggleButtonSetInconsistent

Arguments

:: ToggleButtonClass self |
=> self |
-> Bool | `setting` - `True` if state is inconsistent
-> IO () |

If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a toggle button, and the current values in that range are inconsistent, you may want to display the toggle in an "in between" state. This function turns on "in between" display. Normally you would turn off the inconsistent state again if the user toggles the toggle button. This has to be done manually, `toggleButtonSetInconsistent` only affects visual appearance, it doesn't affect the semantics of the button.

# Attributes

toggleButtonActive :: ToggleButtonClass self => Attr self Bool

If the toggle button should be pressed in or not.

Default value: `False`

toggleButtonInconsistent :: ToggleButtonClass self => Attr self Bool

If the toggle button is in an "in between" state.

Default value: `False`

toggleButtonDrawIndicator :: ToggleButtonClass self => Attr self Bool

If the toggle part of the button is displayed.

Default value: `False`

toggleButtonMode :: ToggleButtonClass self => Attr self Bool

'mode' property. See `toggleButtonGetMode` and `toggleButtonSetMode`

# Signals

toggled :: ToggleButtonClass self => Signal self (IO ())

Should be connected if you wish to perform an action whenever the `ToggleButton'`s state is changed.

# Deprecated

# Signals

onToggled :: ToggleButtonClass self => self -> IO () -> IO (ConnectId self)

afterToggled :: ToggleButtonClass self => self -> IO () -> IO (ConnectId self)

Whenever the state of the button is changed, the toggled signal is emitted.