| Maintainer | gtk2hs-users@lists.sourceforge.net |
|---|---|
| Stability | provisional |
| Portability | portable (depends on GHC) |
| Safe Haskell | None |
| Language | Haskell98 |
Graphics.UI.Gtk.Misc.Switch
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
Types
Instances
| Eq Switch # | |
| Ord Switch # | |
| GObjectClass Switch # | |
Defined in Graphics.UI.Gtk.Types | |
| WidgetClass Switch # | |
Defined in Graphics.UI.Gtk.Types | |
castToSwitch :: GObjectClass obj => obj -> Switch #
gTypeSwitch :: GType #
Constructors
Methods
switchSetActive :: SwitchClass self => self -> Bool -> IO () #
Changes the state of control to the desired one.
See switchGetActive.
switchGetActive :: SwitchClass self => self -> IO Bool #
Gets whether the GtkSwitch is in its on or off state.
switchSetState :: SwitchClass self => self -> Bool -> IO () #
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 #
Gets the underlying state of the GtkSwitch.
Set switchSetState.
Attributes
switchActive :: SwitchClass self => Attr self Bool #
Whether the switch is in its on or off state.
Default value: False
switchState :: SwitchClass self => Attr self Bool #
The backend state that is controlled by the switch. See stateSet for details.
Default value: False
Signals
switchActivate :: SwitchClass self => Signal self (IO ()) #
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) #
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 trough color of the switch,
while the switchActive property is represented by the position of the switch.