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.Entry.SpinButton

Contents

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

Description

Retrieve an integer or floating-point number from the user

Synopsis

- data SpinButton
- class EntryClass o => SpinButtonClass o
- castToSpinButton :: GObjectClass obj => obj -> SpinButton
- gTypeSpinButton :: GType
- toSpinButton :: SpinButtonClass o => o -> SpinButton
- spinButtonNew :: Adjustment -> Double -> Int -> IO SpinButton
- spinButtonNewWithRange :: Double -> Double -> Double -> IO SpinButton
- spinButtonConfigure :: SpinButtonClass self => self -> Adjustment -> Double -> Int -> IO ()
- spinButtonSetAdjustment :: SpinButtonClass self => self -> Adjustment -> IO ()
- spinButtonGetAdjustment :: SpinButtonClass self => self -> IO Adjustment
- spinButtonSetDigits :: SpinButtonClass self => self -> Int -> IO ()
- spinButtonGetDigits :: SpinButtonClass self => self -> IO Int
- spinButtonSetIncrements :: SpinButtonClass self => self -> Double -> Double -> IO ()
- spinButtonGetIncrements :: SpinButtonClass self => self -> IO (Double, Double)
- spinButtonSetRange :: SpinButtonClass self => self -> Double -> Double -> IO ()
- spinButtonGetRange :: SpinButtonClass self => self -> IO (Double, Double)
- spinButtonGetValue :: SpinButtonClass self => self -> IO Double
- spinButtonGetValueAsInt :: SpinButtonClass self => self -> IO Int
- spinButtonSetValue :: SpinButtonClass self => self -> Double -> IO ()
- data SpinButtonUpdatePolicy
  - = UpdateAlways
  - | UpdateIfValid
- spinButtonSetUpdatePolicy :: SpinButtonClass self => self -> SpinButtonUpdatePolicy -> IO ()
- spinButtonGetUpdatePolicy :: SpinButtonClass self => self -> IO SpinButtonUpdatePolicy
- spinButtonSetNumeric :: SpinButtonClass self => self -> Bool -> IO ()
- spinButtonGetNumeric :: SpinButtonClass self => self -> IO Bool
- data SpinType
  - = SpinStepForward
  - | SpinStepBackward
  - | SpinPageForward
  - | SpinPageBackward
  - | SpinHome
  - | SpinEnd
  - | SpinUserDefined
- spinButtonSpin :: SpinButtonClass self => self -> SpinType -> Double -> IO ()
- spinButtonSetWrap :: SpinButtonClass self => self -> Bool -> IO ()
- spinButtonGetWrap :: SpinButtonClass self => self -> IO Bool
- spinButtonSetSnapToTicks :: SpinButtonClass self => self -> Bool -> IO ()
- spinButtonGetSnapToTicks :: SpinButtonClass self => self -> IO Bool
- spinButtonUpdate :: SpinButtonClass self => self -> IO ()
- spinButtonAdjustment :: SpinButtonClass self => Attr self Adjustment
- spinButtonClimbRate :: SpinButtonClass self => Attr self Double
- spinButtonDigits :: SpinButtonClass self => Attr self Int
- spinButtonSnapToTicks :: SpinButtonClass self => Attr self Bool
- spinButtonNumeric :: SpinButtonClass self => Attr self Bool
- spinButtonWrap :: SpinButtonClass self => Attr self Bool
- spinButtonUpdatePolicy :: SpinButtonClass self => Attr self SpinButtonUpdatePolicy
- spinButtonValue :: SpinButtonClass self => Attr self Double
- onInput :: SpinButtonClass sb => sb -> IO (Maybe Double) -> IO (ConnectId sb)
- afterInput :: SpinButtonClass sb => sb -> IO (Maybe Double) -> IO (ConnectId sb)
- onOutput :: SpinButtonClass sb => sb -> IO Bool -> IO (ConnectId sb)
- afterOutput :: SpinButtonClass sb => sb -> IO Bool -> IO (ConnectId sb)
- onValueSpinned :: SpinButtonClass sb => sb -> IO () -> IO (ConnectId sb)
- afterValueSpinned :: SpinButtonClass sb => sb -> IO () -> IO (ConnectId sb)

# Detail

A `SpinButton` is an ideal way to allow the user to set the value of some attribute. Rather than having to directly type a number into a `Entry`, `SpinButton` allows the user to click on one of two arrows to increment or decrement the displayed value. A value can still be typed in, with the bonus that it can be checked to ensure it is in a given range.

The main properties of a `SpinButton` are through a `Adjustment`. See the `Adjustment` section for more details about an adjustment's properties.

# Class Hierarchy

    | GObject
    | +----Object
    | +----Widget
    | +----Entry
    | +----SpinButton

# Types

data SpinButton Source #

#### Instances

Instances details

Eq SpinButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods (==) :: SpinButton -> SpinButton -> Bool Source # (/=) :: SpinButton -> SpinButton -> Bool Source #
Ord SpinButton Source # |

Instance details

Defined in Graphics.UI.Gtk.Types

Methods

compare :: SpinButton -> SpinButton -> Ordering Source #

(<) :: SpinButton -> SpinButton -> Bool Source #

(<=) :: SpinButton -> SpinButton -> Bool Source #

(>) :: SpinButton -> SpinButton -> Bool Source #

(>=) :: SpinButton -> SpinButton -> Bool Source #

max :: SpinButton -> SpinButton -> SpinButton Source #

min :: SpinButton -> SpinButton -> SpinButton Source #

GObjectClass SpinButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods toGObject :: SpinButton -> GObject Source # unsafeCastGObject :: GObject -> SpinButton Source #
EditableClass SpinButton Source # |
Instance details Defined in Graphics.UI.Gtk.Entry.SpinButton
EntryClass SpinButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
SpinButtonClass SpinButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types
WidgetClass SpinButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types

class EntryClass o => SpinButtonClass o Source #

#### Instances

Instances details

SpinButtonClass SpinButton Source # |
Instance details Defined in Graphics.UI.Gtk.Types

castToSpinButton :: GObjectClass obj => obj -> SpinButton Source #

gTypeSpinButton :: GType Source #

toSpinButton :: SpinButtonClass o => o -> SpinButton Source #

# Constructors

spinButtonNew Source #

Arguments

:: Adjustment | `adjustment` - the `Adjustment` object that this spin button should use.
-> Double | `climbRate` - specifies how much the spin button changes when an arrow is clicked on.
-> Int | `digits` - the number of decimal places to display.
-> IO SpinButton |

Creates a new `SpinButton`.

spinButtonNewWithRange Source #

Arguments

:: Double | `min` - Minimum allowable value
-> Double | `max` - Maximum allowable value
-> Double | `step` - Increment added or subtracted by spinning the widget
-> IO SpinButton |

This is a convenience constructor that allows creation of a numeric `SpinButton` without manually creating an adjustment. The value is initially set to the minimum value and a page increment of 10 * `step` is the default. The precision of the spin button is equivalent to the precision of `step`.

Note that the way in which the precision is derived works best if `step` is a power of ten. If the resulting precision is not suitable for your needs, use `spinButtonSetDigits` to correct it.

# Methods

spinButtonConfigure Source #

Arguments

:: SpinButtonClass self |
=> self |
-> Adjustment | `adjustment` - a `Adjustment`.
-> Double | `climbRate` - the new climb rate.
-> Int | `digits` - the number of decimal places to display in the spin button.
-> IO () |

Changes the properties of an existing spin button. The adjustment, climb rate, and number of decimal places are all changed accordingly, after this function call.

spinButtonSetAdjustment Source #

Arguments

:: SpinButtonClass self |
=> self |
-> Adjustment | `adjustment` - a `Adjustment` to replace the existing adjustment
-> IO () |

Replaces the `Adjustment` associated with the spin button.

spinButtonGetAdjustment Source #

Arguments

:: SpinButtonClass self |
=> self |
-> IO Adjustment | returns the `Adjustment` of `spinButton`

Get the adjustment associated with a `SpinButton`

spinButtonSetDigits Source #

Arguments

:: SpinButtonClass self |
=> self |
-> Int | `digits` - the number of digits after the decimal point to be displayed for the spin button's value
-> IO () |

Set the precision to be displayed by `spinButton`. Up to 20 digit precision is allowed.

spinButtonGetDigits Source #

Arguments

:: SpinButtonClass self |
=> self |
-> IO Int | returns the current precision

Fetches the precision of `spinButton`. See `spinButtonSetDigits`.

spinButtonSetIncrements Source #

Arguments

:: SpinButtonClass self |
=> self |
-> Double | `step` - increment applied for a button 1 press.
-> Double | `page` - increment applied for a button 2 press.
-> IO () |

Sets the step and page increments for the spin button. This affects how quickly the value changes when the spin button's arrows are activated.

spinButtonGetIncrements Source #

Arguments

:: SpinButtonClass self |
=> self |
-> IO (Double, Double) | `(step, page)` - step increment and page increment

Gets the current step and page the increments used by the spin button. See `spinButtonSetIncrements`.

spinButtonSetRange Source #

Arguments

:: SpinButtonClass self |
=> self |
-> Double | `min` - minimum allowable value
-> Double | `max` - maximum allowable value
-> IO () |

Sets the minimum and maximum allowable values for the spin button

spinButtonGetRange Source #

Arguments

:: SpinButtonClass self |
=> self |
-> IO (Double, Double) | `(min, max)` - minimum and maximum allowed value

Gets the range allowed for the spin button. See `spinButtonSetRange`.

spinButtonGetValue :: SpinButtonClass self => self -> IO Double Source #

Get the value of the spin button as a floating point value.

spinButtonGetValueAsInt :: SpinButtonClass self => self -> IO Int Source #

Get the value of the spin button as an integral value.

spinButtonSetValue :: SpinButtonClass self => self -> Double -> IO () Source #

Set the value of the spin button.

data SpinButtonUpdatePolicy Source #

Whether to clamp or ignore illegal values.

Constructors

UpdateAlways |
UpdateIfValid |

#### Instances

Instances details

Enum SpinButtonUpdatePolicy Source # |

Instance details

Defined in Graphics.UI.Gtk.General.Enums

Methods

succ :: SpinButtonUpdatePolicy -> SpinButtonUpdatePolicy Source #

pred :: SpinButtonUpdatePolicy -> SpinButtonUpdatePolicy Source #

toEnum :: Int -> SpinButtonUpdatePolicy Source #

fromEnum :: SpinButtonUpdatePolicy -> Int Source #

enumFrom :: SpinButtonUpdatePolicy -> [SpinButtonUpdatePolicy] Source #

enumFromThen :: SpinButtonUpdatePolicy -> SpinButtonUpdatePolicy -> [SpinButtonUpdatePolicy] Source #

enumFromTo :: SpinButtonUpdatePolicy -> SpinButtonUpdatePolicy -> [SpinButtonUpdatePolicy] Source #

enumFromThenTo :: SpinButtonUpdatePolicy -> SpinButtonUpdatePolicy -> SpinButtonUpdatePolicy -> [SpinButtonUpdatePolicy] Source #

Show SpinButtonUpdatePolicy Source # |
Instance details Defined in Graphics.UI.Gtk.General.Enums Methods showsPrec :: Int -> SpinButtonUpdatePolicy -> ShowS Source # show :: SpinButtonUpdatePolicy -> String Source # showList :: [SpinButtonUpdatePolicy] -> ShowS Source #
Eq SpinButtonUpdatePolicy Source # |
Instance details Defined in Graphics.UI.Gtk.General.Enums Methods (==) :: SpinButtonUpdatePolicy -> SpinButtonUpdatePolicy -> Bool Source # (/=) :: SpinButtonUpdatePolicy -> SpinButtonUpdatePolicy -> Bool Source #

spinButtonSetUpdatePolicy Source #

Arguments

:: SpinButtonClass self |
=> self |
-> SpinButtonUpdatePolicy | `policy` - a `SpinButtonUpdatePolicy` value
-> IO () |

Sets the update behavior of a spin button. This determines whether the spin button is always updated or only when a valid value is set.

spinButtonGetUpdatePolicy Source #

Arguments

:: SpinButtonClass self |
=> self |
-> IO SpinButtonUpdatePolicy | returns the current update policy

Gets the update behavior of a spin button. See `spinButtonSetUpdatePolicy`.

spinButtonSetNumeric Source #

Arguments

:: SpinButtonClass self |
=> self |
-> Bool | `numeric` - flag indicating if only numeric entry is allowed.
-> IO () |

Sets the flag that determines if non-numeric text can be typed into the spin button.

spinButtonGetNumeric Source #

Arguments

:: SpinButtonClass self |
=> self |
-> IO Bool | returns `True` if only numeric text can be entered

Returns whether non-numeric text can be typed into the spin button. See `spinButtonSetNumeric`.

data SpinType Source #

Spin a SpinButton with the following method.

Constructors

SpinStepForward |
SpinStepBackward |
SpinPageForward |
SpinPageBackward |
SpinHome |
SpinEnd |
SpinUserDefined |

#### Instances

Instances details

Enum SpinType Source # |

Instance details

Defined in Graphics.UI.Gtk.General.Enums

Methods

succ :: SpinType -> SpinType Source #

pred :: SpinType -> SpinType Source #

toEnum :: Int -> SpinType Source #

fromEnum :: SpinType -> Int Source #

enumFrom :: SpinType -> [SpinType] Source #

enumFromThen :: SpinType -> SpinType -> [SpinType] Source #

enumFromTo :: SpinType -> SpinType -> [SpinType] Source #

enumFromThenTo :: SpinType -> SpinType -> SpinType -> [SpinType] Source #

Show SpinType Source # |
Instance details Defined in Graphics.UI.Gtk.General.Enums Methods showsPrec :: Int -> SpinType -> ShowS Source # show :: SpinType -> String Source # showList :: [SpinType] -> ShowS Source #
Eq SpinType Source # |
Instance details Defined in Graphics.UI.Gtk.General.Enums Methods (==) :: SpinType -> SpinType -> Bool Source # (/=) :: SpinType -> SpinType -> Bool Source #

spinButtonSpin Source #

Arguments

:: SpinButtonClass self |
=> self |
-> SpinType | `direction` - a `SpinType` indicating the direction to spin.
-> Double | `increment` - step increment to apply in the specified direction.
-> IO () |

Increment or decrement a spin button's value in a specified direction by a specified amount.

spinButtonSetWrap Source #

Arguments

:: SpinButtonClass self |
=> self |
-> Bool | `wrap` - a flag indicating if wrapping behavior is performed.
-> IO () |

Sets the flag that determines if a spin button value wraps around to the opposite limit when the upper or lower limit of the range is exceeded.

spinButtonGetWrap Source #

Arguments

:: SpinButtonClass self |
=> self |
-> IO Bool | returns `True` if the spin button wraps around

Returns whether the spin button's value wraps around to the opposite limit when the upper or lower limit of the range is exceeded. See `spinButtonSetWrap`.

spinButtonSetSnapToTicks Source #

Arguments

:: SpinButtonClass self |
=> self |
-> Bool | `snapToTicks` - a flag indicating if invalid values should be corrected.
-> IO () |

Sets the policy as to whether values are corrected to the nearest step increment when a spin button is activated after providing an invalid value.

spinButtonGetSnapToTicks Source #

Arguments

:: SpinButtonClass self |
=> self |
-> IO Bool | returns `True` if values are snapped to the nearest step.

Returns whether the values are corrected to the nearest step. See `spinButtonSetSnapToTicks`.

spinButtonUpdate :: SpinButtonClass self => self -> IO () Source #

Manually force an update of the spin button.

# Attributes

spinButtonAdjustment :: SpinButtonClass self => Attr self Adjustment Source #

The adjustment that holds the value of the spinbutton.

spinButtonClimbRate :: SpinButtonClass self => Attr self Double Source #

The acceleration rate when you hold down a button.

Allowed values: >= 0

Default value: 0

spinButtonDigits :: SpinButtonClass self => Attr self Int Source #

The number of decimal places to display.

Allowed values: <= 20

Default value: 0

spinButtonSnapToTicks :: SpinButtonClass self => Attr self Bool Source #

Whether erroneous values are automatically changed to a spin button's nearest step increment.

Default value: `False`

spinButtonNumeric :: SpinButtonClass self => Attr self Bool Source #

Whether non-numeric characters should be ignored.

Default value: `False`

spinButtonWrap :: SpinButtonClass self => Attr self Bool Source #

Whether a spin button should wrap upon reaching its limits.

Default value: `False`

spinButtonUpdatePolicy :: SpinButtonClass self => Attr self SpinButtonUpdatePolicy Source #

Whether the spin button should update always, or only when the value is legal.

Default value: `UpdateAlways`

spinButtonValue :: SpinButtonClass self => Attr self Double Source #

Reads the current value, or sets a new value.

Default value: 0

# Signals

onInput :: SpinButtonClass sb => sb -> IO (Maybe Double) -> IO (ConnectId sb) Source #

Install a custom input handler.

- This signal is called upon each time the value of the SpinButton is set by spinButtonSetValue. The function can return Nothing if the value is no good.

afterInput :: SpinButtonClass sb => sb -> IO (Maybe Double) -> IO (ConnectId sb) Source #

Install a custom input handler.

- This signal is called upon each time the value of the SpinButton is set by spinButtonSetValue. The function can return Nothing if the value is no good.

onOutput :: SpinButtonClass sb => sb -> IO Bool -> IO (ConnectId sb) Source #

Install a custom output handler.

- This handler makes it possible to query the current value and to render something completely different to the screen using entrySetText. The return value must be False in order to let the default output routine run after this signal returns.

afterOutput :: SpinButtonClass sb => sb -> IO Bool -> IO (ConnectId sb) Source #

Install a custom output handler.

- This handler makes it possible to query the current value and to render something completely different to the screen using entrySetText. The return value must be False in order to let the default output routine run after this signal returns.

onValueSpinned :: SpinButtonClass sb => sb -> IO () -> IO (ConnectId sb) Source #

The value of the spin button has changed.

afterValueSpinned :: SpinButtonClass sb => sb -> IO () -> IO (ConnectId sb) Source #

The value of the spin button has changed.

# Orphan instances

EditableClass SpinButton Source # |
Instance details