Portability | portable (depends on GHC) |
---|---|
Stability | provisional |
Maintainer | gtk2hs-users@lists.sourceforge.net |
Safe Haskell | None |
Create buttons which retain their state
- 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 Source
class ButtonClass o => ToggleButtonClass o Source
castToToggleButton :: GObjectClass obj => obj -> ToggleButtonSource
toToggleButton :: ToggleButtonClass o => o -> ToggleButtonSource
Constructors
toggleButtonNew :: IO ToggleButtonSource
Creates a new toggle button. A widget should be packed into the button,
as in buttonNew
.
toggleButtonNewWithLabelSource
:: String |
|
-> IO ToggleButton |
Creates a new toggle button with a text label.
toggleButtonNewWithMnemonicSource
:: String |
|
-> IO ToggleButton |
Creates a new ToggleButton
containing a label. The label will be
created using labelNewWithMnemonic
,
so underscores in label
indicate the
mnemonic for the button.
Methods
:: ToggleButtonClass self | |
=> self | |
-> Bool |
|
-> 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.
:: ToggleButtonClass self | |
=> self | |
-> IO Bool | returns |
Retrieves whether the button is displayed as a separate indicator and
label. See toggleButtonSetMode
.
toggleButtonToggled :: ToggleButtonClass self => self -> IO ()Source
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 BoolSource
Queries a ToggleButton
and returns its current state. Returns True
if
the toggle button is pressed in and False
if it is raised.
:: ToggleButtonClass self | |
=> self | |
-> Bool |
|
-> 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.
toggleButtonGetInconsistentSource
:: ToggleButtonClass self | |
=> self | |
-> IO Bool | returns |
Gets the value set by toggleButtonSetInconsistent
.
toggleButtonSetInconsistentSource
:: ToggleButtonClass self | |
=> self | |
-> Bool |
|
-> 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 BoolSource
If the toggle button should be pressed in or not.
Default value: False
toggleButtonInconsistent :: ToggleButtonClass self => Attr self BoolSource
If the toggle button is in an "in between" state.
Default value: False
toggleButtonDrawIndicator :: ToggleButtonClass self => Attr self BoolSource
If the toggle part of the button is displayed.
Default value: False
toggleButtonMode :: ToggleButtonClass self => Attr self BoolSource
'mode' property. See toggleButtonGetMode
and toggleButtonSetMode
Signals
toggled :: ToggleButtonClass self => Signal self (IO ())Source
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)Source
Whenever the state of the button is changed, the toggled signal is emitted.
afterToggled :: ToggleButtonClass self => self -> IO () -> IO (ConnectId self)Source
Whenever the state of the button is changed, the toggled signal is emitted.