Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GtkAdjustment
is a model for a numeric value.
The @GtkAdjustment has an associated lower and upper bound. It also contains step and page increments, and a page size.
Adjustments are used within several GTK widgets, including [class@Gtk.SpinButton], [class@Gtk.Viewport], [class@Gtk.Scrollbar] and [class@Gtk.Scale].
The GtkAdjustment
object does not update the value itself. Instead
it is left up to the owner of the @GtkAdjustment` to control the value.
Synopsis
- newtype Adjustment = Adjustment (ManagedPtr Adjustment)
- class (GObject o, IsDescendantOf Adjustment o) => IsAdjustment o
- toAdjustment :: (MonadIO m, IsAdjustment o) => o -> m Adjustment
- adjustmentClampPage :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> Double -> Double -> m ()
- adjustmentConfigure :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> Double -> Double -> Double -> Double -> Double -> Double -> m ()
- adjustmentGetLower :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> m Double
- adjustmentGetMinimumIncrement :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> m Double
- adjustmentGetPageIncrement :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> m Double
- adjustmentGetPageSize :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> m Double
- adjustmentGetStepIncrement :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> m Double
- adjustmentGetUpper :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> m Double
- adjustmentGetValue :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> m Double
- adjustmentNew :: (HasCallStack, MonadIO m) => Double -> Double -> Double -> Double -> Double -> Double -> m Adjustment
- adjustmentSetLower :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> Double -> m ()
- adjustmentSetPageIncrement :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> Double -> m ()
- adjustmentSetPageSize :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> Double -> m ()
- adjustmentSetStepIncrement :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> Double -> m ()
- adjustmentSetUpper :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> Double -> m ()
- adjustmentSetValue :: (HasCallStack, MonadIO m, IsAdjustment a) => a -> Double -> m ()
- constructAdjustmentLower :: (IsAdjustment o, MonadIO m) => Double -> m (GValueConstruct o)
- getAdjustmentLower :: (MonadIO m, IsAdjustment o) => o -> m Double
- setAdjustmentLower :: (MonadIO m, IsAdjustment o) => o -> Double -> m ()
- constructAdjustmentPageIncrement :: (IsAdjustment o, MonadIO m) => Double -> m (GValueConstruct o)
- getAdjustmentPageIncrement :: (MonadIO m, IsAdjustment o) => o -> m Double
- setAdjustmentPageIncrement :: (MonadIO m, IsAdjustment o) => o -> Double -> m ()
- constructAdjustmentPageSize :: (IsAdjustment o, MonadIO m) => Double -> m (GValueConstruct o)
- getAdjustmentPageSize :: (MonadIO m, IsAdjustment o) => o -> m Double
- setAdjustmentPageSize :: (MonadIO m, IsAdjustment o) => o -> Double -> m ()
- constructAdjustmentStepIncrement :: (IsAdjustment o, MonadIO m) => Double -> m (GValueConstruct o)
- getAdjustmentStepIncrement :: (MonadIO m, IsAdjustment o) => o -> m Double
- setAdjustmentStepIncrement :: (MonadIO m, IsAdjustment o) => o -> Double -> m ()
- constructAdjustmentUpper :: (IsAdjustment o, MonadIO m) => Double -> m (GValueConstruct o)
- getAdjustmentUpper :: (MonadIO m, IsAdjustment o) => o -> m Double
- setAdjustmentUpper :: (MonadIO m, IsAdjustment o) => o -> Double -> m ()
- constructAdjustmentValue :: (IsAdjustment o, MonadIO m) => Double -> m (GValueConstruct o)
- getAdjustmentValue :: (MonadIO m, IsAdjustment o) => o -> m Double
- setAdjustmentValue :: (MonadIO m, IsAdjustment o) => o -> Double -> m ()
- type AdjustmentChangedCallback = IO ()
- afterAdjustmentChanged :: (IsAdjustment a, MonadIO m) => a -> ((?self :: a) => AdjustmentChangedCallback) -> m SignalHandlerId
- onAdjustmentChanged :: (IsAdjustment a, MonadIO m) => a -> ((?self :: a) => AdjustmentChangedCallback) -> m SignalHandlerId
- type AdjustmentValueChangedCallback = IO ()
- afterAdjustmentValueChanged :: (IsAdjustment a, MonadIO m) => a -> ((?self :: a) => AdjustmentValueChangedCallback) -> m SignalHandlerId
- onAdjustmentValueChanged :: (IsAdjustment a, MonadIO m) => a -> ((?self :: a) => AdjustmentValueChangedCallback) -> m SignalHandlerId
Exported types
newtype Adjustment Source #
Memory-managed wrapper type.
Adjustment (ManagedPtr Adjustment) |
Instances
Eq Adjustment Source # | |
Defined in GI.Gtk.Objects.Adjustment (==) :: Adjustment -> Adjustment -> Bool # (/=) :: Adjustment -> Adjustment -> Bool # | |
GObject Adjustment Source # | |
Defined in GI.Gtk.Objects.Adjustment | |
ManagedPtrNewtype Adjustment Source # | |
Defined in GI.Gtk.Objects.Adjustment toManagedPtr :: Adjustment -> ManagedPtr Adjustment | |
TypedObject Adjustment Source # | |
Defined in GI.Gtk.Objects.Adjustment | |
HasParentTypes Adjustment Source # | |
Defined in GI.Gtk.Objects.Adjustment | |
IsGValue (Maybe Adjustment) Source # | Convert |
Defined in GI.Gtk.Objects.Adjustment gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Adjustment -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Adjustment) | |
type ParentTypes Adjustment Source # | |
Defined in GI.Gtk.Objects.Adjustment type ParentTypes Adjustment = '[Object] |
class (GObject o, IsDescendantOf Adjustment o) => IsAdjustment o Source #
Type class for types which can be safely cast to Adjustment
, for instance with toAdjustment
.
Instances
(GObject o, IsDescendantOf Adjustment o) => IsAdjustment o Source # | |
Defined in GI.Gtk.Objects.Adjustment |
toAdjustment :: (MonadIO m, IsAdjustment o) => o -> m Adjustment Source #
Cast to Adjustment
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, clampPage, configure, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getLower, getMinimumIncrement, getPageIncrement, getPageSize, getProperty, getQdata, getStepIncrement, getUpper, getValue.
Setters
setData, setDataFull, setLower, setPageIncrement, setPageSize, setProperty, setStepIncrement, setUpper, setValue.
clampPage
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> Double |
|
-> Double |
|
-> m () |
Updates the value property to ensure that the range
between lower
and upper
is in the current page.
The current page goes from value
to value
+ page-size
.
If the range is larger than the page size, then only the
start of it will be in the current page.
A Adjustment::valueChanged signal will be emitted if the value is changed.
configure
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> m () |
Sets all properties of the adjustment at once.
Use this function to avoid multiple emissions of the
Adjustment::changed signal. See
adjustmentSetLower
for an alternative
way of compressing multiple emissions of
Adjustment::changed into one.
getLower
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> m Double | Returns: The current minimum value of the adjustment |
Retrieves the minimum value of the adjustment.
getMinimumIncrement
adjustmentGetMinimumIncrement Source #
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> m Double | Returns: the minimum increment of |
Gets the smaller of step increment and page increment.
getPageIncrement
adjustmentGetPageIncrement Source #
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> m Double | Returns: The current page increment of the adjustment |
Retrieves the page increment of the adjustment.
getPageSize
adjustmentGetPageSize Source #
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> m Double | Returns: The current page size of the adjustment |
Retrieves the page size of the adjustment.
getStepIncrement
adjustmentGetStepIncrement Source #
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> m Double | Returns: The current step increment of the adjustment. |
Retrieves the step increment of the adjustment.
getUpper
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> m Double | Returns: The current maximum value of the adjustment |
Retrieves the maximum value of the adjustment.
getValue
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> m Double | Returns: The current value of the adjustment |
Gets the current value of the adjustment.
new
:: (HasCallStack, MonadIO m) | |
=> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> m Adjustment | Returns: a new |
Creates a new GtkAdjustment
.
setLower
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> Double |
|
-> m () |
Sets the minimum value of the adjustment.
When setting multiple adjustment properties via their individual
setters, multiple Adjustment::changed signals will
be emitted. However, since the emission of the
Adjustment::changed signal is tied to the emission
of the notify signals of the changed properties, it’s possible
to compress the Adjustment::changed signals into one
by calling objectFreezeNotify
and objectThawNotify
around the calls to the individual setters.
Alternatively, using a single g_object_set()
for all the properties
to change, or using adjustmentConfigure
has the same effect.
setPageIncrement
adjustmentSetPageIncrement Source #
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> Double |
|
-> m () |
Sets the page increment of the adjustment.
See adjustmentSetLower
about how to compress
multiple emissions of the Adjustment::changed
signal when setting multiple adjustment properties.
setPageSize
adjustmentSetPageSize Source #
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> Double |
|
-> m () |
Sets the page size of the adjustment.
See adjustmentSetLower
about how to compress
multiple emissions of the Adjustment::changed
signal when setting multiple adjustment properties.
setStepIncrement
adjustmentSetStepIncrement Source #
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> Double |
|
-> m () |
Sets the step increment of the adjustment.
See adjustmentSetLower
about how to compress
multiple emissions of the Adjustment::changed
signal when setting multiple adjustment properties.
setUpper
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> Double |
|
-> m () |
Sets the maximum value of the adjustment.
Note that values will be restricted by upper - page-size
if the page-size property is nonzero.
See adjustmentSetLower
about how to compress
multiple emissions of the Adjustment::changed
signal when setting multiple adjustment properties.
setValue
:: (HasCallStack, MonadIO m, IsAdjustment a) | |
=> a |
|
-> Double |
|
-> m () |
Sets the GtkAdjustment
value.
The value is clamped to lie between Adjustment:lower and Adjustment:upper.
Note that for adjustments which are used in a GtkScrollbar
,
the effective range of allowed values goes from
Adjustment:lower to
Adjustment:upper - Adjustment:pageSize.
Properties
lower
The minimum value of the adjustment.
constructAdjustmentLower :: (IsAdjustment o, MonadIO m) => Double -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “lower
” property. This is rarely needed directly, but it is used by new
.
getAdjustmentLower :: (MonadIO m, IsAdjustment o) => o -> m Double Source #
Get the value of the “lower
” property.
When overloading is enabled, this is equivalent to
get
adjustment #lower
setAdjustmentLower :: (MonadIO m, IsAdjustment o) => o -> Double -> m () Source #
Set the value of the “lower
” property.
When overloading is enabled, this is equivalent to
set
adjustment [ #lower:=
value ]
pageIncrement
The page increment of the adjustment.
constructAdjustmentPageIncrement :: (IsAdjustment o, MonadIO m) => Double -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “page-increment
” property. This is rarely needed directly, but it is used by new
.
getAdjustmentPageIncrement :: (MonadIO m, IsAdjustment o) => o -> m Double Source #
Get the value of the “page-increment
” property.
When overloading is enabled, this is equivalent to
get
adjustment #pageIncrement
setAdjustmentPageIncrement :: (MonadIO m, IsAdjustment o) => o -> Double -> m () Source #
Set the value of the “page-increment
” property.
When overloading is enabled, this is equivalent to
set
adjustment [ #pageIncrement:=
value ]
pageSize
The page size of the adjustment.
Note that the page-size is irrelevant and should be set to zero
if the adjustment is used for a simple scalar value, e.g. in a
GtkSpinButton
.
constructAdjustmentPageSize :: (IsAdjustment o, MonadIO m) => Double -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “page-size
” property. This is rarely needed directly, but it is used by new
.
getAdjustmentPageSize :: (MonadIO m, IsAdjustment o) => o -> m Double Source #
Get the value of the “page-size
” property.
When overloading is enabled, this is equivalent to
get
adjustment #pageSize
setAdjustmentPageSize :: (MonadIO m, IsAdjustment o) => o -> Double -> m () Source #
Set the value of the “page-size
” property.
When overloading is enabled, this is equivalent to
set
adjustment [ #pageSize:=
value ]
stepIncrement
The step increment of the adjustment.
constructAdjustmentStepIncrement :: (IsAdjustment o, MonadIO m) => Double -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “step-increment
” property. This is rarely needed directly, but it is used by new
.
getAdjustmentStepIncrement :: (MonadIO m, IsAdjustment o) => o -> m Double Source #
Get the value of the “step-increment
” property.
When overloading is enabled, this is equivalent to
get
adjustment #stepIncrement
setAdjustmentStepIncrement :: (MonadIO m, IsAdjustment o) => o -> Double -> m () Source #
Set the value of the “step-increment
” property.
When overloading is enabled, this is equivalent to
set
adjustment [ #stepIncrement:=
value ]
upper
The maximum value of the adjustment.
Note that values will be restricted by upper - page-size
if the page-size
property is nonzero.
constructAdjustmentUpper :: (IsAdjustment o, MonadIO m) => Double -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “upper
” property. This is rarely needed directly, but it is used by new
.
getAdjustmentUpper :: (MonadIO m, IsAdjustment o) => o -> m Double Source #
Get the value of the “upper
” property.
When overloading is enabled, this is equivalent to
get
adjustment #upper
setAdjustmentUpper :: (MonadIO m, IsAdjustment o) => o -> Double -> m () Source #
Set the value of the “upper
” property.
When overloading is enabled, this is equivalent to
set
adjustment [ #upper:=
value ]
value
The value of the adjustment.
constructAdjustmentValue :: (IsAdjustment o, MonadIO m) => Double -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “value
” property. This is rarely needed directly, but it is used by new
.
getAdjustmentValue :: (MonadIO m, IsAdjustment o) => o -> m Double Source #
Get the value of the “value
” property.
When overloading is enabled, this is equivalent to
get
adjustment #value
setAdjustmentValue :: (MonadIO m, IsAdjustment o) => o -> Double -> m () Source #
Set the value of the “value
” property.
When overloading is enabled, this is equivalent to
set
adjustment [ #value:=
value ]
Signals
changed
type AdjustmentChangedCallback = IO () Source #
Emitted when one or more of the GtkAdjustment
properties have been
changed.
Note that the Adjustment:value property is covered by the Adjustment::valueChanged signal.
afterAdjustmentChanged :: (IsAdjustment a, MonadIO m) => a -> ((?self :: a) => AdjustmentChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
adjustment #changed callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onAdjustmentChanged :: (IsAdjustment a, MonadIO m) => a -> ((?self :: a) => AdjustmentChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
adjustment #changed callback
valueChanged
type AdjustmentValueChangedCallback = IO () Source #
Emitted when the value has been changed.
afterAdjustmentValueChanged :: (IsAdjustment a, MonadIO m) => a -> ((?self :: a) => AdjustmentValueChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the valueChanged signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
adjustment #valueChanged callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onAdjustmentValueChanged :: (IsAdjustment a, MonadIO m) => a -> ((?self :: a) => AdjustmentValueChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the valueChanged signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
adjustment #valueChanged callback