Package ch.bailu.gtk.gobject
Class SignalGroup
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gobject.SignalGroup
- All Implemented Interfaces:
PointerInterface
#GSignalGroup manages to simplify the process of connecting
many signals to a #GObject 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 #GtkTextView and
#GtkTextBuffer. Often times, you'll need to connect to many signals on
#GtkTextBuffer from a #GtkTextView subclass. This allows you to create a
signal group during instance construction, simply bind the
#GtkTextView:buffer property to #GSignalGroup:target and connect
all the signals you need. When the #GtkTextView:buffer property changes
all of the signals will be transitioned correctly.
many signals to a #GObject 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 #GtkTextView and
#GtkTextBuffer. Often times, you'll need to connect to many signals on
#GtkTextBuffer from a #GtkTextView subclass. This allows you to create a
signal group during instance construction, simply bind the
#GtkTextView:buffer property to #GSignalGroup:target and connect
all the signals you need. When the #GtkTextView:buffer property changes
all of the signals will be transitioned correctly.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
static interface
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
ConstructorDescriptionSignalGroup
(long target_type) Creates a new #GSignalGroup for target instances of @target_type.SignalGroup
(PointerContainer pointer) -
Method Summary
Modifier and TypeMethodDescriptionvoid
block()
Blocks all signal handlers managed by @self so they will not
be called during any signal emissions.void
connect
(Str detailed_signal, SignalGroup.OnCallback c_handler, Pointer data) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.void
connect
(String detailed_signal, SignalGroup.OnCallback c_handler, Pointer data) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.void
connectAfter
(Str detailed_signal, SignalGroup.OnCallback c_handler, Pointer data) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.void
connectAfter
(String detailed_signal, SignalGroup.OnCallback c_handler, Pointer data) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.void
connectClosure
(Str detailed_signal, Closure closure, boolean after) Connects @closure to the signal @detailed_signal on #GSignalGroup:target.void
connectClosure
(String detailed_signal, Closure closure, boolean after) Connects @closure to the signal @detailed_signal on #GSignalGroup:target.void
connectData
(Str detailed_signal, SignalGroup.OnCallback c_handler, Pointer data, SignalGroup.OnClosureNotify notify, int flags) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.void
connectData
(String detailed_signal, SignalGroup.OnCallback c_handler, Pointer data, SignalGroup.OnClosureNotify notify, int flags) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.void
connectObject
(Str detailed_signal, SignalGroup.OnCallback c_handler, Pointer object, int flags) Connects @c_handler to the signal @detailed_signal on #GSignalGroup:target.void
connectObject
(String detailed_signal, SignalGroup.OnCallback c_handler, Pointer object, int flags) Connects @c_handler to the signal @detailed_signal on #GSignalGroup:target.void
connectSwapped
(Str detailed_signal, SignalGroup.OnCallback c_handler, Pointer data) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.void
connectSwapped
(String detailed_signal, SignalGroup.OnCallback c_handler, Pointer data) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.Gets the target instance used when connecting signals.static ClassHandler
static int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
onBind
(SignalGroup.OnBind signal) Connect to signal "bind".onUnbind
(SignalGroup.OnUnbind signal) Connect to signal "unbind".void
Sets the target instance used when connecting signals.void
unblock()
Unblocks all signal handlers managed by @self so they will be
called again during any signal emissions unless it is blocked
again.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_BIND
- See Also:
-
SIGNAL_ON_UNBIND
- See Also:
-
-
Constructor Details
-
SignalGroup
-
SignalGroup
public SignalGroup(long target_type) Creates a new #GSignalGroup for target instances of @target_type.- Parameters:
target_type
- the #GType of the target instance.
-
-
Method Details
-
getClassHandler
-
block
public void block()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. -
connect
public void connect(@Nonnull Str detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.
You cannot connect a signal handler after #GSignalGroup:target has been set.- Parameters:
detailed_signal
- a string of the form "signal-name::detail"c_handler
- the #GCallback to connectdata
- the data to pass to @c_handler calls
-
connect
public void connect(String detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.
You cannot connect a signal handler after #GSignalGroup:target has been set.- Parameters:
detailed_signal
- a string of the form "signal-name::detail"c_handler
- the #GCallback to connectdata
- the data to pass to @c_handler calls
-
connectAfter
public void connectAfter(@Nonnull Str detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.
The @c_handler will be called after the default handler of the signal.
You cannot connect a signal handler after #GSignalGroup:target has been set.- Parameters:
detailed_signal
- a string of the form "signal-name::detail"c_handler
- the #GCallback to connectdata
- the data to pass to @c_handler calls
-
connectAfter
public void connectAfter(String detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.
The @c_handler will be called after the default handler of the signal.
You cannot connect a signal handler after #GSignalGroup:target has been set.- Parameters:
detailed_signal
- a string of the form "signal-name::detail"c_handler
- the #GCallback to connectdata
- the data to pass to @c_handler calls
-
connectClosure
Connects @closure to the signal @detailed_signal on #GSignalGroup:target.
You cannot connect a signal handler after #GSignalGroup:target has been set.- Parameters:
detailed_signal
- a string of the form `signal-name` with optional `::signal-detail`closure
- the closure to connect.after
- whether the handler should be called before or after the default handler of the signal.
-
connectClosure
Connects @closure to the signal @detailed_signal on #GSignalGroup:target.
You cannot connect a signal handler after #GSignalGroup:target has been set.- Parameters:
detailed_signal
- a string of the form `signal-name` with optional `::signal-detail`closure
- the closure to connect.after
- whether the handler should be called before or after the default handler of the signal.
-
connectData
public void connectData(@Nonnull Str detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data, SignalGroup.OnClosureNotify notify, int flags) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.
You cannot connect a signal handler after #GSignalGroup:target has been set.- Parameters:
detailed_signal
- a string of the form "signal-name::detail"c_handler
- the #GCallback to connectdata
- the data to pass to @c_handler callsnotify
- function to be called when disposing of @selfflags
- the flags used to create the signal connection
-
connectData
public void connectData(String detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data, SignalGroup.OnClosureNotify notify, int flags) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.
You cannot connect a signal handler after #GSignalGroup:target has been set.- Parameters:
detailed_signal
- a string of the form "signal-name::detail"c_handler
- the #GCallback to connectdata
- the data to pass to @c_handler callsnotify
- function to be called when disposing of @selfflags
- the flags used to create the signal connection
-
connectObject
public void connectObject(@Nonnull Str detailed_signal, SignalGroup.OnCallback c_handler, @Nonnull Pointer object, int flags) Connects @c_handler to the signal @detailed_signal on #GSignalGroup:target.
Ensures that the @object stays alive during the call to @c_handler
by temporarily adding a reference count. When the @object is destroyed
the signal handler will automatically be removed.
You cannot connect a signal handler after #GSignalGroup:target has been set.- Parameters:
detailed_signal
- a string of the form `signal-name` with optional `::signal-detail`c_handler
- the #GCallback to connectobject
- the #GObject to pass as data to @c_handler callsflags
- #GConnectFlags for the signal connection
-
connectObject
public void connectObject(String detailed_signal, SignalGroup.OnCallback c_handler, @Nonnull Pointer object, int flags) Connects @c_handler to the signal @detailed_signal on #GSignalGroup:target.
Ensures that the @object stays alive during the call to @c_handler
by temporarily adding a reference count. When the @object is destroyed
the signal handler will automatically be removed.
You cannot connect a signal handler after #GSignalGroup:target has been set.- Parameters:
detailed_signal
- a string of the form `signal-name` with optional `::signal-detail`c_handler
- the #GCallback to connectobject
- the #GObject to pass as data to @c_handler callsflags
- #GConnectFlags for the signal connection
-
connectSwapped
public void connectSwapped(@Nonnull Str detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.
The instance on which the signal is emitted and @data
will be swapped when calling @c_handler.
You cannot connect a signal handler after #GSignalGroup:target has been set.- Parameters:
detailed_signal
- a string of the form "signal-name::detail"c_handler
- the #GCallback to connectdata
- the data to pass to @c_handler calls
-
connectSwapped
public void connectSwapped(String detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data) Connects @c_handler to the signal @detailed_signal
on the target instance of @self.
The instance on which the signal is emitted and @data
will be swapped when calling @c_handler.
You cannot connect a signal handler after #GSignalGroup:target has been set.- Parameters:
detailed_signal
- a string of the form "signal-name::detail"c_handler
- the #GCallback to connectdata
- the data to pass to @c_handler calls
-
dupTarget
Gets the target instance used when connecting signals.- Returns:
- The target instance
-
setTarget
Sets the target instance used when connecting signals. Any signal
that has been registered with g_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.- Parameters:
target
- The target instance used when connecting signals.
-
unblock
public void unblock()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. -
onBind
Connect to signal "bind".
SeeSignalGroup.OnBind.onBind(ch.bailu.gtk.gobject.Object)
for signal description.
FieldSIGNAL_ON_BIND
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onUnbind
Connect to signal "unbind".
SeeSignalGroup.OnUnbind.onUnbind()
for signal description.
FieldSIGNAL_ON_UNBIND
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-