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

Portabilityportable (depends on GHC)
Stabilityprovisional
Maintainergtk2hs-users@lists.sourceforge.net
Safe HaskellNone

Graphics.UI.Gtk.Buttons.ToggleButton

Contents

Description

Create buttons which retain their state

Synopsis

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

Constructors

toggleButtonNew :: IO ToggleButtonSource

Creates a new toggle button. A widget should be packed into the button, as in buttonNew.

toggleButtonNewWithLabelSource

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.

toggleButtonNewWithMnemonicSource

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 labelNewWithMnemonic, so underscores in label indicate the mnemonic for the button.

Methods

toggleButtonSetModeSource

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.

toggleButtonGetModeSource

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 ()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.

toggleButtonSetActiveSource

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.

toggleButtonGetInconsistentSource

Arguments

:: ToggleButtonClass self 
=> self 
-> IO Bool

returns True if the button is displayed as inconsistent, False otherwise

Gets the value set by toggleButtonSetInconsistent.

toggleButtonSetInconsistentSource

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

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.