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 |
GI.Dazzle.Objects.SignalGroup
Description
SignalGroup
manages to simplify the process of connecting
many signals to a Object
as a group. As such there is no API
to disconnect a signal from the group.
In particular, this allows you to:
- Change the target instance, which automatically causes disconnection of the signals from the old instance and connecting to the new instance.
- Block and unblock signals as a group
- Ensuring that blocked state transfers across target instances.
One place you might want to use such a structure is with TextView
and
TextBuffer
. Often times, you'll need to connect to many signals on
TextBuffer
from a TextView
subclass. This allows you to create a
signal group during instance construction, simply bind the
TextView:buffer property to SignalGroup:target and connect
all the signals you need. When the TextView:buffer property changes
all of the signals will be transitioned correctly.
Synopsis
- newtype SignalGroup = SignalGroup (ManagedPtr SignalGroup)
- class (GObject o, IsDescendantOf SignalGroup o) => IsSignalGroup o
- toSignalGroup :: (MonadIO m, IsSignalGroup o) => o -> m SignalGroup
- signalGroupBlock :: (HasCallStack, MonadIO m, IsSignalGroup a) => a -> m ()
- signalGroupConnectData :: (HasCallStack, MonadIO m, IsSignalGroup a) => a -> Text -> Callback -> [ConnectFlags] -> m ()
- signalGroupConnectSwapped :: (HasCallStack, MonadIO m, IsSignalGroup a) => a -> Text -> Callback -> m ()
- signalGroupGetTarget :: (HasCallStack, MonadIO m, IsSignalGroup a) => a -> m (Maybe Object)
- signalGroupNew :: (HasCallStack, MonadIO m) => GType -> m SignalGroup
- signalGroupSetTarget :: (HasCallStack, MonadIO m, IsSignalGroup a, IsObject b) => a -> Maybe b -> m ()
- signalGroupUnblock :: (HasCallStack, MonadIO m, IsSignalGroup a) => a -> m ()
- clearSignalGroupTarget :: (MonadIO m, IsSignalGroup o) => o -> m ()
- constructSignalGroupTarget :: (IsSignalGroup o, MonadIO m, IsObject a) => a -> m (GValueConstruct o)
- getSignalGroupTarget :: (MonadIO m, IsSignalGroup o) => o -> m (Maybe Object)
- setSignalGroupTarget :: (MonadIO m, IsSignalGroup o, IsObject a) => o -> a -> m ()
- constructSignalGroupTargetType :: (IsSignalGroup o, MonadIO m) => GType -> m (GValueConstruct o)
- getSignalGroupTargetType :: (MonadIO m, IsSignalGroup o) => o -> m GType
- type SignalGroupBindCallback = Object -> IO ()
- afterSignalGroupBind :: (IsSignalGroup a, MonadIO m) => a -> ((?self :: a) => SignalGroupBindCallback) -> m SignalHandlerId
- onSignalGroupBind :: (IsSignalGroup a, MonadIO m) => a -> ((?self :: a) => SignalGroupBindCallback) -> m SignalHandlerId
- type SignalGroupUnbindCallback = IO ()
- afterSignalGroupUnbind :: (IsSignalGroup a, MonadIO m) => a -> ((?self :: a) => SignalGroupUnbindCallback) -> m SignalHandlerId
- onSignalGroupUnbind :: (IsSignalGroup a, MonadIO m) => a -> ((?self :: a) => SignalGroupUnbindCallback) -> m SignalHandlerId
Exported types
newtype SignalGroup Source #
Memory-managed wrapper type.
Constructors
SignalGroup (ManagedPtr SignalGroup) |
Instances
Eq SignalGroup Source # | |
Defined in GI.Dazzle.Objects.SignalGroup | |
GObject SignalGroup Source # | |
Defined in GI.Dazzle.Objects.SignalGroup | |
ManagedPtrNewtype SignalGroup Source # | |
Defined in GI.Dazzle.Objects.SignalGroup Methods toManagedPtr :: SignalGroup -> ManagedPtr SignalGroup | |
TypedObject SignalGroup Source # | |
Defined in GI.Dazzle.Objects.SignalGroup | |
HasParentTypes SignalGroup Source # | |
Defined in GI.Dazzle.Objects.SignalGroup | |
IsGValue (Maybe SignalGroup) Source # | Convert |
Defined in GI.Dazzle.Objects.SignalGroup Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe SignalGroup -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe SignalGroup) | |
type ParentTypes SignalGroup Source # | |
Defined in GI.Dazzle.Objects.SignalGroup type ParentTypes SignalGroup = '[Object] |
class (GObject o, IsDescendantOf SignalGroup o) => IsSignalGroup o Source #
Type class for types which can be safely cast to SignalGroup
, for instance with toSignalGroup
.
Instances
(GObject o, IsDescendantOf SignalGroup o) => IsSignalGroup o Source # | |
Defined in GI.Dazzle.Objects.SignalGroup |
toSignalGroup :: (MonadIO m, IsSignalGroup o) => o -> m SignalGroup Source #
Cast to SignalGroup
, 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, block, connectData, connectSwapped, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unblock, unref, watchClosure.
Getters
getData, getProperty, getQdata, getTarget.
Setters
block
Arguments
:: (HasCallStack, MonadIO m, IsSignalGroup a) | |
=> a |
|
-> m () |
Blocks all signal handlers managed by self
so they will not
be called during any signal emissions. Must be unblocked exactly
the same number of times it has been blocked to become active again.
This blocked state will be kept across changes of the target instance.
See: signalHandlerBlock
.
connectData
signalGroupConnectData Source #
Arguments
:: (HasCallStack, MonadIO m, IsSignalGroup a) | |
=> a |
|
-> Text |
|
-> Callback |
|
-> [ConnectFlags] |
|
-> m () |
Connects callback
to the signal detailedSignal
on the target instance of self
.
See: g_signal_connect_data()
.
connectSwapped
signalGroupConnectSwapped Source #
Arguments
:: (HasCallStack, MonadIO m, IsSignalGroup a) | |
=> a |
|
-> Text |
|
-> Callback |
|
-> m () |
Connects callback
to the signal detailedSignal
on the target instance of self
.
The instance on which the signal is emitted and data
will be swapped when calling callback
.
See: g_signal_connect_swapped()
.
getTarget
Arguments
:: (HasCallStack, MonadIO m, IsSignalGroup a) | |
=> a |
|
-> m (Maybe Object) | Returns: The target instance. |
Gets the target instance used when connecting signals.
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> GType |
|
-> m SignalGroup | Returns: a new |
Creates a new SignalGroup
for target instances of targetType
.
setTarget
Arguments
:: (HasCallStack, MonadIO m, IsSignalGroup a, IsObject b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the target instance used when connecting signals. Any signal
that has been registered with dzl_signal_group_connect_object()
or
similar functions will be connected to this object.
If the target instance was previously set, signals will be
disconnected from that object prior to connecting to target
.
unblock
Arguments
:: (HasCallStack, MonadIO m, IsSignalGroup a) | |
=> a |
|
-> m () |
Unblocks all signal handlers managed by self
so they will be
called again during any signal emissions unless it is blocked
again. Must be unblocked exactly the same number of times it
has been blocked to become active again.
See: signalHandlerUnblock
.
Properties
target
The target instance used when connecting signals.
clearSignalGroupTarget :: (MonadIO m, IsSignalGroup o) => o -> m () Source #
Set the value of the “target
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#target
constructSignalGroupTarget :: (IsSignalGroup o, MonadIO m, IsObject a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “target
” property. This is rarely needed directly, but it is used by new
.
getSignalGroupTarget :: (MonadIO m, IsSignalGroup o) => o -> m (Maybe Object) Source #
Get the value of the “target
” property.
When overloading is enabled, this is equivalent to
get
signalGroup #target
setSignalGroupTarget :: (MonadIO m, IsSignalGroup o, IsObject a) => o -> a -> m () Source #
Set the value of the “target
” property.
When overloading is enabled, this is equivalent to
set
signalGroup [ #target:=
value ]
targetType
The GType of the target property.
constructSignalGroupTargetType :: (IsSignalGroup o, MonadIO m) => GType -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “target-type
” property. This is rarely needed directly, but it is used by new
.
getSignalGroupTargetType :: (MonadIO m, IsSignalGroup o) => o -> m GType Source #
Get the value of the “target-type
” property.
When overloading is enabled, this is equivalent to
get
signalGroup #targetType
Signals
bind
afterSignalGroupBind :: (IsSignalGroup a, MonadIO m) => a -> ((?self :: a) => SignalGroupBindCallback) -> m SignalHandlerId Source #
Connect a signal handler for the bind signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
signalGroup #bind 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.
onSignalGroupBind :: (IsSignalGroup a, MonadIO m) => a -> ((?self :: a) => SignalGroupBindCallback) -> m SignalHandlerId Source #
Connect a signal handler for the bind signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
signalGroup #bind callback
unbind
type SignalGroupUnbindCallback = IO () Source #
afterSignalGroupUnbind :: (IsSignalGroup a, MonadIO m) => a -> ((?self :: a) => SignalGroupUnbindCallback) -> m SignalHandlerId Source #
Connect a signal handler for the unbind signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
signalGroup #unbind 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.
onSignalGroupUnbind :: (IsSignalGroup a, MonadIO m) => a -> ((?self :: a) => SignalGroupUnbindCallback) -> m SignalHandlerId Source #
Connect a signal handler for the unbind signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
signalGroup #unbind callback