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.Misc.Switch

Contents

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

Description

A "light switch" style toggle

Synopsis

- data Switch
- castToSwitch :: GObjectClass obj => obj -> Switch
- gTypeSwitch :: GType
- toSwitch :: SwitchClass o => o -> Switch
- switchNew :: IO Switch
- switchSetActive :: SwitchClass self => self -> Bool -> IO ()
- switchGetActive :: SwitchClass self => self -> IO Bool
- switchSetState :: SwitchClass self => self -> Bool -> IO ()
- switchGetState :: SwitchClass self => self -> IO Bool
- switchActive :: SwitchClass self => Attr self Bool
- switchState :: SwitchClass self => Attr self Bool
- switchActivate :: SwitchClass self => Signal self (IO ())
- stateSet :: SwitchClass self => Signal self (Bool -> IO Bool)

# Detail

# Class Hierarchy

    | GObject
    | +----Object
    | +----Widget
    | +----Switch

# Types

data Switch Source #

#### Instances

Instances details

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

castToSwitch :: GObjectClass obj => obj -> Switch Source #

gTypeSwitch :: GType Source #

toSwitch :: SwitchClass o => o -> Switch Source #

# Constructors

switchNew :: IO Switch Source #

Creates a new `Switch`.

# Methods

switchSetActive :: SwitchClass self => self -> Bool -> IO () Source #

Changes the state of control to the desired one. See `switchGetActive`.

switchGetActive :: SwitchClass self => self -> IO Bool Source #

Gets whether the GtkSwitch is in its on or off state.

switchSetState :: SwitchClass self => self -> Bool -> IO () Source #

Sets the underlying state of the GtkSwitch. Normally, this is the same as `switchActive`, unless the switch is set up for delayed state changes. This function is typically called from a `stateSet` signal handler.

See `stateSet` for details.

switchGetState :: SwitchClass self => self -> IO Bool Source #

Gets the underlying state of the GtkSwitch. Set `switchSetState`.

# Attributes

switchActive :: SwitchClass self => Attr self Bool Source #

Whether the switch is in its on or off state.

Default value: `False`

switchState :: SwitchClass self => Attr self Bool Source #

The backend state that is controlled by the switch. See `stateSet` for details.

Default value: `False`

# Signals

switchActivate :: SwitchClass self => Signal self (IO ()) Source #

This signal on GtkSwitch is an action signal and emitting it causes the switch to animate. Applications should never connect to this signal, but use the notify::active signal.

stateSet :: SwitchClass self => Signal self (Bool -> IO Bool) Source #

This signal on GtkSwitch is emitted to change the underlying state. It is emitted when the user changes the switch position. The default handler keeps the state in sync with the `switchActive` property.

To implement delayed state change, applications can connect to this signal, initiate the change of the underlying state, and call `switchSetState` when the underlying state change is complete. The signal handler should return `True` to prevent the default handler from running.

Visually, the underlying state is represented by the through color of the switch, while the `switchActive` property is represented by the position of the switch.