Remove GtkSignal completely
This commit is contained in:
@ -1898,7 +1898,7 @@ not applied you'll have to use the
|
|||||||
function. <literal>gtk_object_class_user_signal_new</literal> allows you
|
function. <literal>gtk_object_class_user_signal_new</literal> allows you
|
||||||
to add a new signal to a predefined GTK+ widget without any
|
to add a new signal to a predefined GTK+ widget without any
|
||||||
modification of the GTK+ source code. The new signal can be
|
modification of the GTK+ source code. The new signal can be
|
||||||
emited with <literal>gtk_signal_emit</literal> and can be
|
emited with <literal>g_signal_emit</literal> and can be
|
||||||
handled in the same way as other signals.</para>
|
handled in the same way as other signals.</para>
|
||||||
|
|
||||||
<para>Tim Janik posted this code snippet:</para>
|
<para>Tim Janik posted this code snippet:</para>
|
||||||
@ -1920,7 +1920,7 @@ gtk_widget_user_action (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
gtk_signal_emit (GTK_OBJECT (widget), signal_user_action, act_data);
|
g_signal_emit (widget, signal_user_action, act_data);
|
||||||
}
|
}
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
@ -2559,10 +2559,10 @@ into the entry.</para>
|
|||||||
signal handler with</para>
|
signal handler with</para>
|
||||||
|
|
||||||
<programlisting role="C">
|
<programlisting role="C">
|
||||||
gtk_signal_connect(GTK_COMBO(cb)->entry,
|
g_signal_connect(GTK_COMBO(cb)->entry,
|
||||||
"changed",
|
"changed",
|
||||||
GTK_SIGNAL_FUNC(my_cb_change_handler),
|
G_CALLBACK(my_cb_change_handler),
|
||||||
NULL);
|
NULL);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
@ -2864,9 +2864,9 @@ be:</para>
|
|||||||
|
|
||||||
<programlisting role="C">
|
<programlisting role="C">
|
||||||
entry = gtk_entry_new();
|
entry = gtk_entry_new();
|
||||||
gtk_signal_connect (GTK_OBJECT(entry), "activate",
|
g_signal_connect (entry, "activate",
|
||||||
GTK_SIGNAL_FUNC(entry_callback),
|
G_CALLBACK(entry_callback),
|
||||||
NULL);
|
NULL);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
@ -3044,8 +3044,8 @@ main (int argc, char *argv[])
|
|||||||
gtk_container_add (GTK_CONTAINER (window), text);
|
gtk_container_add (GTK_CONTAINER (window), text);
|
||||||
|
|
||||||
/* connect after everything else */
|
/* connect after everything else */
|
||||||
gtk_signal_connect_after (GTK_OBJECT(text), "button_press_event",
|
g_signal_connect_after (text, "button_press_event",
|
||||||
GTK_SIGNAL_FUNC (insert_bar), NULL);
|
G_CALLBACK (insert_bar), NULL);
|
||||||
|
|
||||||
gtk_widget_show_all(window);
|
gtk_widget_show_all(window);
|
||||||
gtk_main();
|
gtk_main();
|
||||||
|
|||||||
@ -6293,46 +6293,6 @@ gtk_drag_source_add_image_targets
|
|||||||
gtk_drag_source_add_uri_targets
|
gtk_drag_source_add_uri_targets
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
|
||||||
<SECTION>
|
|
||||||
<FILE>gtksignal</FILE>
|
|
||||||
<TITLE>Signals</TITLE>
|
|
||||||
GTK_SIGNAL_OFFSET
|
|
||||||
GtkSignalRunType
|
|
||||||
gtk_signal_new
|
|
||||||
gtk_signal_newv
|
|
||||||
gtk_signal_lookup
|
|
||||||
gtk_signal_name
|
|
||||||
gtk_signal_emit
|
|
||||||
gtk_signal_emit_by_name
|
|
||||||
gtk_signal_emitv
|
|
||||||
gtk_signal_emitv_by_name
|
|
||||||
gtk_signal_emit_stop
|
|
||||||
gtk_signal_emit_stop_by_name
|
|
||||||
gtk_signal_connect
|
|
||||||
gtk_signal_connect_after
|
|
||||||
gtk_signal_connect_object
|
|
||||||
gtk_signal_connect_object_after
|
|
||||||
gtk_signal_connect_full
|
|
||||||
gtk_signal_connect_while_alive
|
|
||||||
gtk_signal_connect_object_while_alive
|
|
||||||
gtk_signal_disconnect
|
|
||||||
gtk_signal_disconnect_by_func
|
|
||||||
gtk_signal_disconnect_by_data
|
|
||||||
gtk_signal_handler_block
|
|
||||||
gtk_signal_handler_block_by_func
|
|
||||||
gtk_signal_handler_block_by_data
|
|
||||||
gtk_signal_handler_unblock
|
|
||||||
gtk_signal_handler_unblock_by_func
|
|
||||||
gtk_signal_handler_unblock_by_data
|
|
||||||
gtk_signal_handler_pending
|
|
||||||
gtk_signal_handler_pending_by_func
|
|
||||||
gtk_signal_default_marshaller
|
|
||||||
|
|
||||||
<SUBSECTION Private>
|
|
||||||
gtk_signal_compat_matched
|
|
||||||
</SECTION>
|
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>gtktypeutils</FILE>
|
<FILE>gtktypeutils</FILE>
|
||||||
<TITLE>Types</TITLE>
|
<TITLE>Types</TITLE>
|
||||||
|
|||||||
@ -22,9 +22,9 @@ or gtk_object_get).
|
|||||||
they describe <wordasword>signal arguments</wordasword>.
|
they describe <wordasword>signal arguments</wordasword>.
|
||||||
This is a lot less often needed but still useful.
|
This is a lot less often needed but still useful.
|
||||||
Usually if you are just emitting or creating a particular signal
|
Usually if you are just emitting or creating a particular signal
|
||||||
it is more convenient to just use gtk_signal_emit() or gtk_signal_new().
|
it is more convenient to just use g_signal_emit() or g_signal_new().
|
||||||
However if you are writing a function to emit or create an arbitrary
|
However if you are writing a function to emit or create an arbitrary
|
||||||
signal, you must use gtk_signal_emitv() or gtk_signal_newv().
|
signal, you must use g_signal_emitv() or g_signal_newv().
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
@ -133,7 +133,7 @@ gboolean sigfunc(gpointer,gint,gint,guint);
|
|||||||
<refsect2>
|
<refsect2>
|
||||||
<title>Writing Custom Marshals</title>
|
<title>Writing Custom Marshals</title>
|
||||||
<para>
|
<para>
|
||||||
Marshals are primarily used as arguments to gtk_signal_new().
|
Marshals are primarily used as arguments to g_signal_new().
|
||||||
Sometimes, you may find that a marshaller you need isn't available
|
Sometimes, you may find that a marshaller you need isn't available
|
||||||
in the standard list. Then you have to write your own.
|
in the standard list. Then you have to write your own.
|
||||||
</para>
|
</para>
|
||||||
@ -1203,7 +1203,7 @@ and swapped when the signal handler is invoked.
|
|||||||
This is useful for handlers that are primarily notifying
|
This is useful for handlers that are primarily notifying
|
||||||
other objects and could just invoke an already existing function
|
other objects and could just invoke an already existing function
|
||||||
if the parameters were swapped.
|
if the parameters were swapped.
|
||||||
See gtk_signal_connect_object() for more details.
|
See g_signal_connect_swapped() for more details.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
@ -1215,7 +1215,7 @@ and swapped when the signal handler is invoked,
|
|||||||
and so that the handler is invoked after all others.
|
and so that the handler is invoked after all others.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
See gtk_signal_connect_object_after() for more details.
|
See g_signal_connect_data() for more details.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
@ -2899,14 +2899,14 @@ See the signal documentation for more general information.
|
|||||||
@klass: the object class to define the signal for.
|
@klass: the object class to define the signal for.
|
||||||
@name: the name of the signal.
|
@name: the name of the signal.
|
||||||
@signal_flags: the default emission behavior for the signal.
|
@signal_flags: the default emission behavior for the signal.
|
||||||
See gtk_signal_new().
|
See g_signal_new().
|
||||||
@marshaller: a function that will take an array of GtkArgs
|
@marshaller: a function that will take an array of GtkArgs
|
||||||
and invoke the appropriate handler with the normal calling
|
and invoke the appropriate handler with the normal calling
|
||||||
conventions.
|
conventions.
|
||||||
@return_val: specify the return-value type for the signal
|
@return_val: specify the return-value type for the signal
|
||||||
(or GTK_TYPE_NONE for no return-value).
|
(or GTK_TYPE_NONE for no return-value).
|
||||||
@nparams: specify the number of parameters the signal
|
@nparams: specify the number of parameters the signal
|
||||||
receives from the caller of gtk_signal_emit().
|
receives from the caller of g_signal_emit().
|
||||||
@Varargs: list of nparams #GtkTypes to pass to the signal handlers.
|
@Varargs: list of nparams #GtkTypes to pass to the signal handlers.
|
||||||
@Returns: the signal id. (See #GtkSignals)
|
@Returns: the signal id. (See #GtkSignals)
|
||||||
|
|
||||||
@ -2919,7 +2919,7 @@ object.
|
|||||||
@klass: the object class to define the signal for.
|
@klass: the object class to define the signal for.
|
||||||
@name: the name of the signal.
|
@name: the name of the signal.
|
||||||
@signal_flags: the default emission behavior for the signal.
|
@signal_flags: the default emission behavior for the signal.
|
||||||
See gtk_signal_new().
|
See g_signal_new().
|
||||||
@marshaller: takes a GtkObject, a #GtkSignalFunc, and an array
|
@marshaller: takes a GtkObject, a #GtkSignalFunc, and an array
|
||||||
of arguments, and invokes the function using the appropriate
|
of arguments, and invokes the function using the appropriate
|
||||||
calling conventions. Usually just select a function
|
calling conventions. Usually just select a function
|
||||||
@ -2927,7 +2927,7 @@ out of gtkmarshal.h.
|
|||||||
@return_val: specify the return-value type for the signal (possibly
|
@return_val: specify the return-value type for the signal (possibly
|
||||||
#GTK_TYPE_NONE).
|
#GTK_TYPE_NONE).
|
||||||
@nparams: specify the number of parameters the signal
|
@nparams: specify the number of parameters the signal
|
||||||
receives from the caller of gtk_signal_emit().
|
receives from the caller of g_signal_emit().
|
||||||
@params: array of #GtkTypes the signal handlers for this signal
|
@params: array of #GtkTypes the signal handlers for this signal
|
||||||
should have in their prototype (of length nparams).
|
should have in their prototype (of length nparams).
|
||||||
@Returns: the signal id. (See #GtkSignals)
|
@Returns: the signal id. (See #GtkSignals)
|
||||||
@ -3328,131 +3328,6 @@ Internal function.
|
|||||||
|
|
||||||
@Returns:
|
@Returns:
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_add_emission_hook ##### -->
|
|
||||||
<para>
|
|
||||||
Add an emission hook for a type of signal, for any object.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@signal_id: the type of signal to hook for.
|
|
||||||
@hook_func: the function to invoke to handle the emission hook.
|
|
||||||
@data: the user data passed in to hook_func.
|
|
||||||
@Returns: the id (that you may pass as a parameter
|
|
||||||
to gtk_signal_remove_emission_hook()).
|
|
||||||
@i:
|
|
||||||
@h:
|
|
||||||
@d:
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_add_emission_hook_full ##### -->
|
|
||||||
<para>
|
|
||||||
Add an emission hook for a type of signal, for any object.
|
|
||||||
(with control of what happens when the hook is
|
|
||||||
destroyed).
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@signal_id: the type of signal add the hook for.
|
|
||||||
@hook_func: the function to invoke to handle the hook.
|
|
||||||
@data: the user data passed in to hook_func.
|
|
||||||
@destroy: a function to invoke when the hook is destroyed,
|
|
||||||
to clean up any allocation done just for this
|
|
||||||
signal handler.
|
|
||||||
@Returns: the id (that you may pass as a parameter
|
|
||||||
to gtk_signal_remove_emission_hook()).
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_handler_pending_by_id ##### -->
|
|
||||||
<para>
|
|
||||||
Returns whether a connection id is valid (and optionally not blocked).
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object to search for the desired handler.
|
|
||||||
@handler_id: the connection id.
|
|
||||||
@may_be_blocked: whether it is acceptable to return a blocked
|
|
||||||
handler.
|
|
||||||
@Returns: TRUE if the signal exists and wasn't blocked,
|
|
||||||
unless #may_be_blocked was specified. FALSE otherwise.
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_handlers_destroy ##### -->
|
|
||||||
<para>
|
|
||||||
Destroy all the signal handlers connected to an object.
|
|
||||||
This is done automatically when the object is destroyed.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
This function is labeled private.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object whose signal handlers should be destroyed.
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_init ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_n_emissions ##### -->
|
|
||||||
<para>
|
|
||||||
Find out the recursion depth of emissions for a particular type
|
|
||||||
of signal and object. (So it will
|
|
||||||
always return 0 or 1 if #GTK_RUN_NO_RECURSE is specified)
|
|
||||||
This is a way to avoid recursion: you can see if
|
|
||||||
you are currently running in that signal handler and emit it only
|
|
||||||
if you are.
|
|
||||||
</para>
|
|
||||||
<para>Another way to look at it is that this number increases
|
|
||||||
by one when #gtk_signal_emit(), et al, are called,
|
|
||||||
and decreases by one when #gtk_signal_emit() returns.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object with the signal handler.
|
|
||||||
@signal_id: the signal id.
|
|
||||||
@Returns: the recursion depth of emissions of this signal for this
|
|
||||||
object.
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_n_emissions_by_name ##### -->
|
|
||||||
<para>
|
|
||||||
Find out the recursion depth of emissions for a particular type
|
|
||||||
of signal and object. Just like gtk_signal_n_emissions()
|
|
||||||
except it will lookup the signal id for you.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object with the signal handler.
|
|
||||||
@name: the signal name.
|
|
||||||
@Returns: the recursion depth of emissions of this signal for this
|
|
||||||
object.
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_query ##### -->
|
|
||||||
<para>
|
|
||||||
Obtain information about a signal.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@signal_id: the signal type identifier.
|
|
||||||
@Returns: a pointer to a GtkSignalQuery structure
|
|
||||||
which contains all the information, or NULL.
|
|
||||||
The pointer is allocated just for you: you must g_free() it.
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_remove_emission_hook ##### -->
|
|
||||||
<para>
|
|
||||||
Delete an emission hook. (see gtk_signal_add_emission_hook())
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@signal_id: the id of the signal type.
|
|
||||||
@hook_id: the id of the emission handler, returned by add_emission_hook().
|
|
||||||
@i:
|
|
||||||
@h:
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_set_funcs ##### -->
|
|
||||||
<para>
|
|
||||||
These set default functions to call when the user didn't
|
|
||||||
supply a function when connecting. (These are rarely
|
|
||||||
used, and probably only for language bindings)
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
By default, there are no such functions.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@marshal_func: the function to invoke on every handlers for which there
|
|
||||||
isn't a function pointer. May be NULL.
|
|
||||||
@destroy_func: the function to invoke when each hook is destroyed.
|
|
||||||
May be NULL.
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_spin_button_set_shadow_type ##### -->
|
<!-- ##### FUNCTION gtk_spin_button_set_shadow_type ##### -->
|
||||||
<para>
|
<para>
|
||||||
Creates a border around the arrows of a #GtkSpinButton. The type of border is determined by @shadow_type.
|
Creates a border around the arrows of a #GtkSpinButton. The type of border is determined by @shadow_type.
|
||||||
|
|||||||
@ -1,759 +0,0 @@
|
|||||||
<!-- ##### SECTION Title ##### -->
|
|
||||||
Signals
|
|
||||||
|
|
||||||
<!-- ##### SECTION Short_Description ##### -->
|
|
||||||
Object methods and callbacks
|
|
||||||
|
|
||||||
<!-- ##### SECTION Long_Description ##### -->
|
|
||||||
<para>
|
|
||||||
The GTK+ signal system merely proxies the GLib signal system now. For future
|
|
||||||
usage, direct use of the <link linkend="gobject-Signals">GSignal</link> API is recommended, this avoids significant
|
|
||||||
performance hits where #GtkArg structures have to be converted into #GValue<!-- -->s.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<refsect2>
|
|
||||||
<title>What are signals?</title>
|
|
||||||
<para>
|
|
||||||
Signals are a way to get notification when something happens
|
|
||||||
and to customize object behavior according to the
|
|
||||||
user's needs.
|
|
||||||
Every <wordasword>signal</wordasword> is uniquely identified by a name,
|
|
||||||
"class_name::signal_name", where signal_name might be something like
|
|
||||||
"clicked" and class_name might be "GtkButton". Note that some other class
|
|
||||||
may also define a "clicked" callback, so long as it doesn't derive from
|
|
||||||
#GtkButton.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
When they are created, they are also assigned a unique positive integer,
|
|
||||||
the signal id (1 is the first signal id- 0 is used to flag an error).
|
|
||||||
Each is also tied to an array of types that describes
|
|
||||||
the prototype of the function pointer(s) (handlers) you may
|
|
||||||
connect to the signal. Finally, every signal has
|
|
||||||
a default handler that is given by a function pointer
|
|
||||||
in its class structure: it is run by default whenever the
|
|
||||||
signal is emitted. (It is possible that a signal will
|
|
||||||
be emitted and a user-defined handler will prevent the default handler
|
|
||||||
from being run.)
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Signals are used by everyone, but they are only
|
|
||||||
created on a per class basis -- so you should not call
|
|
||||||
call gtk_signal_new() unless you are writing
|
|
||||||
a new #GtkObject type. However, if you want to make a new signal
|
|
||||||
for an existing type, you may use gtk_object_class_user_signal_new()
|
|
||||||
to create a signal that doesn't correspond to a class's builtin
|
|
||||||
methods.
|
|
||||||
</para>
|
|
||||||
</refsect2>
|
|
||||||
<refsect2>
|
|
||||||
<title>How are signals used?</title>
|
|
||||||
<para>
|
|
||||||
There are two basic actions in the signal handling game.
|
|
||||||
If you want notification of an event, you must <emphasis>connect</emphasis>
|
|
||||||
a function pointer and a data pointer to that signal; the data pointer
|
|
||||||
will be passed as the last argument to the function (so long as you
|
|
||||||
are using the default marshalling functions).
|
|
||||||
You will receive a connection id, a unique positive integer
|
|
||||||
corresponding to that attachment.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Functions that want to notify the user of certain actions,
|
|
||||||
<emphasis>emit</emphasis> signals.
|
|
||||||
</para>
|
|
||||||
</refsect2>
|
|
||||||
<refsect2>
|
|
||||||
<title>Basic Terminology</title>
|
|
||||||
<variablelist>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>signal</term>
|
|
||||||
<listitem><para>A class method, e.g. GtkButton::clicked.
|
|
||||||
More precisely it is a unique class-branch/signal-name pair.
|
|
||||||
This means you may not define a signal handler for a class which
|
|
||||||
derives from #GtkButton that is called clicked,
|
|
||||||
but it is okay to share signals names if they are separate in
|
|
||||||
the class tree.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>default handler</term>
|
|
||||||
<listitem><para>The object's internal method which is invoked
|
|
||||||
when the signal is emitted.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>user-defined handler</term>
|
|
||||||
<listitem><para>A function pointer and data connected
|
|
||||||
to a signal (for a particular object).</para>
|
|
||||||
<para>There are really two types: those which are connected
|
|
||||||
normally, and those which are connected by one
|
|
||||||
of the connect_after functions. The connect_after handlers
|
|
||||||
are always run after the default handler.</para>
|
|
||||||
<para>Many toolkits refer to these as <wordasword>callbacks</wordasword>.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>emission</term>
|
|
||||||
<listitem><para>the whole process of emitting a signal,
|
|
||||||
including the invocation of all
|
|
||||||
the different handler types mentioned above.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>signal id</term>
|
|
||||||
<listitem><para>The unique positive (nonzero) integer
|
|
||||||
used to identify a signal. It can be used instead of
|
|
||||||
a name to many functions for a slight performance
|
|
||||||
improvement.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>connection id</term>
|
|
||||||
<listitem><para>The unique positive (nonzero) integer
|
|
||||||
used to identify the connection of a user-defined handler
|
|
||||||
to a signal. Notice that it is allowed to connect the
|
|
||||||
same function-pointer/user-data pair twice, so
|
|
||||||
there is no guarantee that a function-pointer/user-data
|
|
||||||
maps to a unique connection id.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
|
||||||
</refsect2>
|
|
||||||
|
|
||||||
<refsect2><title>A brief note on how they work.</title>
|
|
||||||
<para>
|
|
||||||
The functions responsible for translating an array of #GtkArgs
|
|
||||||
to your C compiler's normal semantics are called Marshallers.
|
|
||||||
They are identified by
|
|
||||||
gtk_marshal_<replaceable>return_value</replaceable>__<replaceable>parameter_list</replaceable>()
|
|
||||||
for example a C function returning a gboolean and taking a gint
|
|
||||||
can be invoked by using gtk_marshal_BOOL__INT().
|
|
||||||
Not all possibly combinations of return/params are available,
|
|
||||||
of course, so if you are writing a #GtkObject with parameters
|
|
||||||
you might have to write a marshaller.
|
|
||||||
</para>
|
|
||||||
</refsect2>
|
|
||||||
|
|
||||||
<!-- ##### SECTION See_Also ##### -->
|
|
||||||
<para>
|
|
||||||
<variablelist>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>#GtkObject</term>
|
|
||||||
<listitem><para>The base class for things which emit signals.</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><link linkend="gobject-Signals">GSignal</link></term>
|
|
||||||
<listitem><para>The GLib signal system.</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<!-- ##### SECTION Stability_Level ##### -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO GTK_SIGNAL_OFFSET ##### -->
|
|
||||||
<para>
|
|
||||||
Use in place of <function>offsetof()</function>, which is used if it exists.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### ENUM GtkSignalRunType ##### -->
|
|
||||||
<para>
|
|
||||||
These configure the signal's emission. They control
|
|
||||||
whether the signal can be emitted recursively on an object
|
|
||||||
and
|
|
||||||
whether to run the default method before or after the user-defined handlers.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>GTK_RUN_FIRST</term>
|
|
||||||
<listitem><para>Run the default handler before the connected user-defined
|
|
||||||
handlers.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>GTK_RUN_LAST</term>
|
|
||||||
<listitem><para>Run the default handler after the connected
|
|
||||||
user-defined handlers.
|
|
||||||
(Handlers registered as "after" always run after the default handler though)
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>GTK_RUN_BOTH</term>
|
|
||||||
<listitem><para>Run the default handler twice,
|
|
||||||
once before the user-defined handlers,
|
|
||||||
and
|
|
||||||
once after.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>GTK_RUN_NO_RECURSE</term>
|
|
||||||
<listitem><para>Whether to prevent a handler or hook
|
|
||||||
from reemitting the signal from within itself.
|
|
||||||
Attempts to
|
|
||||||
emit the signal while it is running will result in the signal
|
|
||||||
emission being restarted once it is done with the current processing.
|
|
||||||
</para><para>
|
|
||||||
You must be
|
|
||||||
careful to avoid having two handlers endlessly reemitting signals,
|
|
||||||
gtk_signal_n_emissions() can be helpful.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>GTK_RUN_ACTION</term>
|
|
||||||
<listitem><para>The signal is an action you can
|
|
||||||
invoke without any particular setup or cleanup.
|
|
||||||
The signal is treated no differently, but some
|
|
||||||
other code can determine if the signal is appropriate to
|
|
||||||
delegate to user control. For example, key binding sets
|
|
||||||
only allow bindings of ACTION signals to keystrokes.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>GTK_RUN_NO_HOOKS</term>
|
|
||||||
<listitem><para>This prevents the connection of emission hooks
|
|
||||||
to the signal.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
@GTK_RUN_FIRST:
|
|
||||||
@GTK_RUN_LAST:
|
|
||||||
@GTK_RUN_BOTH:
|
|
||||||
@GTK_RUN_NO_RECURSE:
|
|
||||||
@GTK_RUN_ACTION:
|
|
||||||
@GTK_RUN_NO_HOOKS:
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_new ##### -->
|
|
||||||
<para>
|
|
||||||
Creates a new signal type. (This is usually done in the
|
|
||||||
class initializer.)
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@name: the event name for the signal, e.g. "clicked".
|
|
||||||
@signal_flags: a combination of #GTK_RUN flags
|
|
||||||
specifying detail of when the default handler is to be invoked.
|
|
||||||
You should at least specify #GTK_RUN_FIRST
|
|
||||||
or #GTK_RUN_LAST.
|
|
||||||
@object_type: the type of object this signal pertains to.
|
|
||||||
It will also pertain to derivers of this type automatically.
|
|
||||||
@function_offset: How many bytes the function pointer is in
|
|
||||||
the class structure for this type. Used to invoke a class
|
|
||||||
method generically.
|
|
||||||
@marshaller: the function to translate between an array
|
|
||||||
of GtkArgs and the native calling convention. Usually they
|
|
||||||
are identified just by the type of arguments they take:
|
|
||||||
for example, gtk_marshal_BOOL__STRING() describes a marshaller
|
|
||||||
which takes a string and returns a boolean value.
|
|
||||||
@return_val: the type of return value, or #GTK_TYPE_NONE for a signal
|
|
||||||
without a return value.
|
|
||||||
@n_args: the number of parameter the handlers may take.
|
|
||||||
@Varargs: a list of #GTK_TYPE_*, one for each parameter.
|
|
||||||
@Returns: the signal id.
|
|
||||||
@Deprecated: Use g_signal_new() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_newv ##### -->
|
|
||||||
<para>
|
|
||||||
Creates a new signal type. (This is usually done in a
|
|
||||||
class initializer.)
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
This function take the types as an array, instead of a list
|
|
||||||
following the arguments. Otherwise the same as gtk_signal_new().
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@name: the name of the signal to create.
|
|
||||||
@signal_flags: see gtk_signal_new().
|
|
||||||
@object_type: the type of #GtkObject to associate the signal with.
|
|
||||||
@function_offset: how many bytes the function pointer is in
|
|
||||||
the class structure for this type.
|
|
||||||
@marshaller:
|
|
||||||
@return_val: the type of the return value, or #GTK_TYPE_NONE if
|
|
||||||
you don't want a return value.
|
|
||||||
@n_args: the number of parameters to the user-defined handlers.
|
|
||||||
@args: an array of #GtkType<!---->s, describing the prototype to
|
|
||||||
the callbacks.
|
|
||||||
@Returns: the signal id.
|
|
||||||
@Deprecated: Use g_signal_newv() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_lookup ##### -->
|
|
||||||
<para>
|
|
||||||
Given the name of the signal and the type of object it connects
|
|
||||||
to, get the signal's identifying integer. Emitting the signal
|
|
||||||
by number is somewhat faster than using the name each time.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
It also tries the ancestors of the given type.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@name: the signal's name, e.g. clicked.
|
|
||||||
@object_type: the type that the signal operates on, e.g. #GTK_TYPE_BUTTON.
|
|
||||||
@Returns: the signal's identifying number, or 0 if no signal was found.
|
|
||||||
@Deprecated: Use g_signal_lookup() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_name ##### -->
|
|
||||||
<para>
|
|
||||||
Given the signal's identifier, finds its name.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Two different signals may have the same name, if they have differing types.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@signal_id: the signal's identifying number.
|
|
||||||
@Returns: the signal name, or %NULL if the signal number was invalid.
|
|
||||||
@Deprecated: Use g_signal_name() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_emit ##### -->
|
|
||||||
<para>
|
|
||||||
Emits a signal. This causes the default handler and user-defined
|
|
||||||
handlers to be run.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Here is what gtk_signal_emit() does:
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
1. Calls the default handler and the user-connected handlers.
|
|
||||||
The default handler will be called first if
|
|
||||||
#GTK_RUN_FIRST is set, and last if #GTK_RUN_LAST is set.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
2. Calls all handlers connected with the "after" flag set.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object that emits the signal.
|
|
||||||
@signal_id: the signal identifier.
|
|
||||||
@Varargs: the parameters to the function, followed
|
|
||||||
by a pointer to the return type, if any.
|
|
||||||
@Deprecated: Use g_signal_emit() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_emit_by_name ##### -->
|
|
||||||
<para>
|
|
||||||
Emits a signal. This causes the default handler and user-connected
|
|
||||||
handlers to be run.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object that emits the signal.
|
|
||||||
@name: the name of the signal.
|
|
||||||
@Varargs: the parameters to the function, followed
|
|
||||||
by a pointer to the return type, if any.
|
|
||||||
@Deprecated: Use g_signal_emit_by_name() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_emitv ##### -->
|
|
||||||
<para>
|
|
||||||
Emits a signal. This causes the default handler and user-connected
|
|
||||||
handlers to be run. This differs from gtk_signal_emit() by taking
|
|
||||||
an array of GtkArgs instead of using C's varargs mechanism.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object to emit the signal to.
|
|
||||||
@signal_id: the signal identifier.
|
|
||||||
@args: an array of GtkArgs, one for each parameter,
|
|
||||||
followed by one which is a pointer to the return type.
|
|
||||||
@Deprecated: Use g_signal_emitv() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_emitv_by_name ##### -->
|
|
||||||
<para>
|
|
||||||
Emits a signal by name. This causes the default handler and user-connected
|
|
||||||
handlers to be run. This differs from gtk_signal_emit() by taking
|
|
||||||
an array of GtkArgs instead of using C's varargs mechanism.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object to emit the signal to.
|
|
||||||
@name: the name of the signal.
|
|
||||||
@args: an array of GtkArgs, one for each parameter,
|
|
||||||
followed by one which is a pointer to the return type.
|
|
||||||
@Deprecated: Use g_signal_emitv() and g_signal_lookup() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_emit_stop ##### -->
|
|
||||||
<para>
|
|
||||||
This function aborts a signal's current emission.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
It will prevent the default method from running,
|
|
||||||
if the signal was #GTK_RUN_LAST and you connected
|
|
||||||
normally (i.e. without the "after" flag).
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
It will print a warning if used on a signal which
|
|
||||||
isn't being emitted.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object whose signal handlers you wish to stop.
|
|
||||||
@signal_id: the signal identifier, as returned by g_signal_lookup().
|
|
||||||
@Deprecated: Use g_signal_stop_emission() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_emit_stop_by_name ##### -->
|
|
||||||
<para>
|
|
||||||
This function aborts a signal's current emission.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
It is just like gtk_signal_emit_stop()
|
|
||||||
except it will lookup the signal id for you.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object whose signal handlers you wish to stop.
|
|
||||||
@name: the name of the signal you wish to stop.
|
|
||||||
@Deprecated: Use g_signal_stop_emission_by_name() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_connect ##### -->
|
|
||||||
<para>
|
|
||||||
Attaches a function pointer and user data to a signal for
|
|
||||||
a particular object.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
The #GtkSignalFunction takes a #GtkObject as its first parameter.
|
|
||||||
It will be the same object as the one you're connecting
|
|
||||||
the hook to. The @func_data will be passed as the last parameter
|
|
||||||
to the hook.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
All else being equal, signal handlers are invoked in the order
|
|
||||||
connected (see gtk_signal_emit() for the other details of
|
|
||||||
which order things are called in).
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Here is how one passes an integer as user data,
|
|
||||||
for when you just want to specify a constant int
|
|
||||||
as parameter to your function:
|
|
||||||
</para>
|
|
||||||
<informalexample>
|
|
||||||
<programlisting>
|
|
||||||
static void button_clicked_int (GtkButton* button, gpointer func_data)
|
|
||||||
{
|
|
||||||
g_print ("button pressed: %d\n", GPOINTER_TO_INT (func_data));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* By calling this function, you will make the g_print above
|
|
||||||
* execute, printing the number passed as `to_print'. */
|
|
||||||
static void attach_print_signal (GtkButton* button, gint to_print)
|
|
||||||
{
|
|
||||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
|
||||||
GTK_SIGNAL_FUNC (button_clicked_int),
|
|
||||||
GINT_TO_POINTER (to_print));
|
|
||||||
}
|
|
||||||
</programlisting>
|
|
||||||
</informalexample>
|
|
||||||
|
|
||||||
@object: the object associated with the signal, e.g. if a button
|
|
||||||
is getting pressed, this is that button.
|
|
||||||
@name: name of the signal.
|
|
||||||
@func: function pointer to attach to the signal.
|
|
||||||
@func_data: value to pass as to your function (through the marshaller).
|
|
||||||
@Returns: the connection id.
|
|
||||||
@Deprecated: Use g_signal_connect() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_connect_after ##### -->
|
|
||||||
<para>
|
|
||||||
Attaches a function pointer and user data to a signal
|
|
||||||
so that this handler will be called after the other handlers.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object associated with the signal.
|
|
||||||
@name: name of the signal.
|
|
||||||
@func: function pointer to attach to the signal.
|
|
||||||
@func_data: value to pass as to your function (through the marshaller).
|
|
||||||
@Returns: the unique identifier for this attachment: the connection id.
|
|
||||||
@Deprecated: Use g_signal_connect_after() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_connect_object ##### -->
|
|
||||||
<para>
|
|
||||||
This function is for registering a callback that will
|
|
||||||
call another object's callback. That is,
|
|
||||||
instead of passing the object which is responsible
|
|
||||||
for the event as the first parameter of the callback,
|
|
||||||
it is switched with the user data (so the object which emits
|
|
||||||
the signal will be the last parameter, which is where the
|
|
||||||
user data usually is).
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
This is useful for passing a standard function in as a callback.
|
|
||||||
For example, if you wanted a button's press to gtk_widget_show()
|
|
||||||
some widget, you could write:
|
|
||||||
</para>
|
|
||||||
<informalexample>
|
|
||||||
<programlisting>
|
|
||||||
gtk_signal_connect_object (button, "clicked", gtk_widget_show, window);
|
|
||||||
</programlisting>
|
|
||||||
</informalexample>
|
|
||||||
|
|
||||||
@object: the object which emits the signal.
|
|
||||||
@name: the name of the signal.
|
|
||||||
@func: the function to callback.
|
|
||||||
@slot_object: the object to pass as the first parameter to func.
|
|
||||||
(Though it pretends to take an object, you can
|
|
||||||
really pass any gpointer as the #slot_object .)
|
|
||||||
@Returns: the connection id.
|
|
||||||
@Deprecated: Use g_signal_connect_swapped() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_connect_object_after ##### -->
|
|
||||||
<para>
|
|
||||||
Attaches a signal hook to a signal, passing in an alternate
|
|
||||||
object as the first parameter, and guaranteeing
|
|
||||||
that the default handler and all normal
|
|
||||||
handlers are called first.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object associated with the signal.
|
|
||||||
@name: name of the signal.
|
|
||||||
@func: function pointer to attach to the signal.
|
|
||||||
@slot_object: the object to pass as the first parameter to #func.
|
|
||||||
@Returns: the connection id.
|
|
||||||
@Deprecated: Use g_signal_connect_data() instead, passing
|
|
||||||
<literal>G_CONNECT_AFTER|G_CONNECT_SWAPPED</literal> as @connect_flags.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_connect_full ##### -->
|
|
||||||
<para>
|
|
||||||
Attaches a function pointer and user data to a signal with
|
|
||||||
more control.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object which emits the signal. For example, a button
|
|
||||||
in the button press signal.
|
|
||||||
@name: the name of the signal.
|
|
||||||
@func: function pointer to attach to the signal.
|
|
||||||
@unsupported:
|
|
||||||
@data: the user data associated with the function.
|
|
||||||
@destroy_func: function to call when this particular hook is
|
|
||||||
disconnected.
|
|
||||||
@object_signal: whether this is an object signal-- basically an "object
|
|
||||||
signal" is one that wants its user_data and object fields switched,
|
|
||||||
which is useful for calling functions which operate on another
|
|
||||||
object primarily.
|
|
||||||
@after: whether to invoke the user-defined handler after the signal, or to let
|
|
||||||
the signal's default behavior preside (i.e. depending on #GTK_RUN_FIRST
|
|
||||||
and #GTK_RUN_LAST).
|
|
||||||
@Returns: the connection id.
|
|
||||||
@Deprecated: Use g_signal_connect_data() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_connect_while_alive ##### -->
|
|
||||||
<para>
|
|
||||||
Attaches a function pointer and another #GtkObject to a signal.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
This function takes an object whose "destroy" signal
|
|
||||||
should be trapped.
|
|
||||||
That way, you don't have to clean up the
|
|
||||||
signal handler when you destroy the object.
|
|
||||||
It is a little less efficient though.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
(Instead you may call gtk_signal_disconnect_by_data(), if you want
|
|
||||||
to explicitly delete all attachments to this object. This
|
|
||||||
is perhaps not recommended since it could be confused
|
|
||||||
with an integer masquerading as a pointer (through GINT_TO_POINTER()).)
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object that emits the signal.
|
|
||||||
@name: name of the signal.
|
|
||||||
@func: function pointer to attach to the signal.
|
|
||||||
@func_data: pointer to pass to func.
|
|
||||||
@alive_object: object whose death should cause the handler connection
|
|
||||||
to be destroyed.
|
|
||||||
@Deprecated: Use g_signal_connect_object() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_signal_connect_object_while_alive ##### -->
|
|
||||||
<para>
|
|
||||||
These signal connectors are for signals which refer to objects,
|
|
||||||
so they must not be called after the object is deleted.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Unlike gtk_signal_connect_while_alive(),
|
|
||||||
this swaps the object and user data, making it suitable for
|
|
||||||
use with functions which primarily operate on the user data.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
This function acts just like gtk_signal_connect_object() except
|
|
||||||
it traps the "destroy" signal to prevent you from having to
|
|
||||||
clean up the handler.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object associated with the signal.
|
|
||||||
@name: name of the signal.
|
|
||||||
@func: function pointer to attach to the signal.
|
|
||||||
@alive_object: the user data, which must be an object, whose destruction
|
|
||||||
should signal the removal of this signal.
|
|
||||||
@Deprecated: Use g_signal_connect_object() instead, passing
|
|
||||||
<literal>G_CONNECT_SWAPPED</literal> as @connect_flags.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_disconnect ##### -->
|
|
||||||
<para>
|
|
||||||
Destroys a user-defined handler connection.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object which the handler pertains to.
|
|
||||||
@handler_id: the connection id.
|
|
||||||
@Deprecated: Use g_signal_handler_disconnect() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_disconnect_by_func ##### -->
|
|
||||||
<para>
|
|
||||||
Destroys all connections for a particular object, with
|
|
||||||
the given function-pointer and user-data.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object which emits the signal.
|
|
||||||
@func: the function pointer to search for.
|
|
||||||
@data: the user data to search for.
|
|
||||||
@Deprecated: Use g_signal_handlers_disconnect_by_func() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_disconnect_by_data ##### -->
|
|
||||||
<para>
|
|
||||||
Destroys all connections for a particular object, with
|
|
||||||
the given user-data.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object which emits the signal.
|
|
||||||
@data: the user data to search for.
|
|
||||||
@Deprecated: Use g_signal_handlers_disconnect_matched() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_handler_block ##### -->
|
|
||||||
<para>
|
|
||||||
Prevents a user-defined handler from being invoked. All other
|
|
||||||
signal processing will go on as normal, but this particular
|
|
||||||
handler will ignore it.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object which emits the signal to block.
|
|
||||||
@handler_id: the connection id.
|
|
||||||
@Deprecated: Use g_signal_handler_block() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_handler_block_by_func ##### -->
|
|
||||||
<para>
|
|
||||||
Prevents a user-defined handler from being invoked, by reference to
|
|
||||||
the user-defined handler's function pointer and user data. (It may result in
|
|
||||||
multiple hooks being blocked, if you've called connect multiple times.)
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object which emits the signal to block.
|
|
||||||
@func: the function pointer of the handler to block.
|
|
||||||
@data: the user data of the handler to block.
|
|
||||||
@Deprecated: Use g_signal_handlers_block_by_func() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_handler_block_by_data ##### -->
|
|
||||||
<para>
|
|
||||||
Prevents all user-defined handlers with a certain user data from being invoked.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object which emits the signal we want to block.
|
|
||||||
@data: the user data of the handlers to block.
|
|
||||||
@Deprecated: Use g_signal_handlers_block_matched() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_handler_unblock ##### -->
|
|
||||||
<para>
|
|
||||||
Undoes a block, by connection id. Note that undoing a block doesn't
|
|
||||||
necessarily make the hook callable, because if you block a
|
|
||||||
hook twice, you must unblock it twice.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object which emits the signal we want to unblock.
|
|
||||||
@handler_id: the emission handler identifier, as returned by
|
|
||||||
gtk_signal_connect(), etc.
|
|
||||||
@Deprecated: Use g_signal_handler_unblock() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_handler_unblock_by_func ##### -->
|
|
||||||
<para>
|
|
||||||
Undoes a block, by function pointer and data.
|
|
||||||
Note that undoing a block doesn't
|
|
||||||
necessarily make the hook callable, because if you block a
|
|
||||||
hook twice, you must unblock it twice.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object which emits the signal we want to unblock.
|
|
||||||
@func: the function pointer to search for.
|
|
||||||
@data: the user data to search for.
|
|
||||||
@Deprecated: Use g_signal_handlers_unblock_by_func() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_handler_unblock_by_data ##### -->
|
|
||||||
<para>
|
|
||||||
Undoes block(s), to all signals for a particular object
|
|
||||||
with a particular user-data pointer
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object which emits the signal we want to unblock.
|
|
||||||
@data: the user data to search for.
|
|
||||||
@Deprecated: Use g_signal_handlers_unblock_matched() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_handler_pending ##### -->
|
|
||||||
<para>
|
|
||||||
Returns a connection id corresponding to a given signal id and object.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
One example of when you might use this is when the arguments
|
|
||||||
to the signal are difficult to compute. A class implementor
|
|
||||||
may opt to not emit the signal if no one is attached anyway,
|
|
||||||
thus saving the cost of building the arguments.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object to search for the desired user-defined handler.
|
|
||||||
@signal_id: the number of the signal to search for.
|
|
||||||
@may_be_blocked: whether it is acceptable to return a blocked
|
|
||||||
handler.
|
|
||||||
@Returns: the connection id, if a connection was found. 0 otherwise.
|
|
||||||
@Deprecated: Use g_signal_has_handler_pending() instead.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_handler_pending_by_func ##### -->
|
|
||||||
<para>
|
|
||||||
Returns a connection id corresponding to a given signal id, object, function
|
|
||||||
pointer and user data.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@object: the object to search for the desired handler.
|
|
||||||
@signal_id: the number of the signal to search for.
|
|
||||||
@may_be_blocked: whether it is acceptable to return a blocked
|
|
||||||
handler.
|
|
||||||
@func: the function pointer to search for.
|
|
||||||
@data: the user data to search for.
|
|
||||||
@Returns: the connection id, if a handler was found. 0 otherwise.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO gtk_signal_default_marshaller ##### -->
|
|
||||||
<para>
|
|
||||||
A marshaller that returns void and takes no extra parameters.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -637,12 +637,10 @@ gtk_base_c_sources = \
|
|||||||
gtk_public_h_sources += \
|
gtk_public_h_sources += \
|
||||||
gtkpixmap.h \
|
gtkpixmap.h \
|
||||||
gtkprogress.h \
|
gtkprogress.h \
|
||||||
gtksignal.h \
|
|
||||||
gtktooltips.h
|
gtktooltips.h
|
||||||
gtk_base_c_sources += \
|
gtk_base_c_sources += \
|
||||||
gtkpixmap.c \
|
gtkpixmap.c \
|
||||||
gtkprogress.c \
|
gtkprogress.c \
|
||||||
gtksignal.c \
|
|
||||||
gtktooltips.c
|
gtktooltips.c
|
||||||
|
|
||||||
gtk_c_sources = $(gtk_base_c_sources)
|
gtk_c_sources = $(gtk_base_c_sources)
|
||||||
|
|||||||
@ -372,7 +372,6 @@ gtk_scroll_type_get_type G_GNUC_CONST
|
|||||||
gtk_selection_mode_get_type G_GNUC_CONST
|
gtk_selection_mode_get_type G_GNUC_CONST
|
||||||
gtk_shadow_type_get_type G_GNUC_CONST
|
gtk_shadow_type_get_type G_GNUC_CONST
|
||||||
gtk_side_type_get_type G_GNUC_CONST
|
gtk_side_type_get_type G_GNUC_CONST
|
||||||
gtk_signal_run_type_get_type G_GNUC_CONST
|
|
||||||
gtk_size_group_mode_get_type G_GNUC_CONST
|
gtk_size_group_mode_get_type G_GNUC_CONST
|
||||||
gtk_sort_type_get_type G_GNUC_CONST
|
gtk_sort_type_get_type G_GNUC_CONST
|
||||||
gtk_spin_type_get_type G_GNUC_CONST
|
gtk_spin_type_get_type G_GNUC_CONST
|
||||||
@ -3404,24 +3403,6 @@ gtk_rc_property_parse_requisition
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if IN_HEADER(__GTK_SIGNAL_H__)
|
|
||||||
#if IN_FILE(__GTK_SIGNAL_C__)
|
|
||||||
#ifndef GTK_DISABLE_DEPRECATED
|
|
||||||
gtk_signal_compat_matched
|
|
||||||
gtk_signal_connect_full
|
|
||||||
gtk_signal_connect_object_while_alive
|
|
||||||
gtk_signal_connect_while_alive
|
|
||||||
gtk_signal_emit
|
|
||||||
gtk_signal_emit_by_name
|
|
||||||
gtk_signal_emit_stop_by_name
|
|
||||||
gtk_signal_emitv
|
|
||||||
gtk_signal_emitv_by_name
|
|
||||||
gtk_signal_new
|
|
||||||
gtk_signal_newv
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if IN_HEADER(__GTK_SIZE_GROUP_H__)
|
#if IN_HEADER(__GTK_SIZE_GROUP_H__)
|
||||||
#if IN_FILE(__GTK_SIZE_GROUP_C__)
|
#if IN_FILE(__GTK_SIZE_GROUP_C__)
|
||||||
gtk_size_group_add_widget
|
gtk_size_group_add_widget
|
||||||
|
|||||||
@ -36,9 +36,6 @@
|
|||||||
|
|
||||||
#include <gtk/gtkwidget.h>
|
#include <gtk/gtkwidget.h>
|
||||||
|
|
||||||
/* Not needed, retained for compatibility -Yosh */
|
|
||||||
#include <gtk/gtksignal.h>
|
|
||||||
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|||||||
@ -2501,9 +2501,8 @@ gtk_print (gchar *str)
|
|||||||
{
|
{
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed),
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
&window);
|
|
||||||
|
|
||||||
gtk_window_set_title (GTK_WINDOW (window), "Messages");
|
gtk_window_set_title (GTK_WINDOW (window), "Messages");
|
||||||
|
|
||||||
@ -2552,9 +2551,8 @@ gtk_print (gchar *str)
|
|||||||
|
|
||||||
|
|
||||||
button = gtk_button_new_with_label ("close");
|
button = gtk_button_new_with_label ("close");
|
||||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
g_signal_connect_swapped (button, "clicked",
|
||||||
G_CALLBACK (gtk_widget_hide),
|
G_CALLBACK (gtk_widget_hide), window);
|
||||||
GTK_OBJECT (window));
|
|
||||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||||
gtk_widget_set_can_default (button, TRUE);
|
gtk_widget_set_can_default (button, TRUE);
|
||||||
gtk_widget_grab_default (button);
|
gtk_widget_grab_default (button);
|
||||||
|
|||||||
394
gtk/gtksignal.c
394
gtk/gtksignal.c
@ -1,394 +0,0 @@
|
|||||||
/* GTK - The GIMP Toolkit
|
|
||||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef GTK_DISABLE_DEPRECATED
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include "gtksignal.h"
|
|
||||||
#include "gtkalias.h"
|
|
||||||
|
|
||||||
/* the real parameter limit is of course given by GSignal, bu we need
|
|
||||||
* an upper limit for the implementations. so this should be adjusted
|
|
||||||
* with any future changes on the GSignal side of things.
|
|
||||||
*/
|
|
||||||
#define SIGNAL_MAX_PARAMS 12
|
|
||||||
|
|
||||||
|
|
||||||
/* --- functions --- */
|
|
||||||
guint
|
|
||||||
gtk_signal_newv (const gchar *name,
|
|
||||||
GtkSignalRunType signal_flags,
|
|
||||||
GType object_type,
|
|
||||||
guint function_offset,
|
|
||||||
GSignalCMarshaller marshaller,
|
|
||||||
GType return_val,
|
|
||||||
guint n_params,
|
|
||||||
GType *params)
|
|
||||||
{
|
|
||||||
GClosure *closure;
|
|
||||||
|
|
||||||
g_return_val_if_fail (n_params < SIGNAL_MAX_PARAMS, 0);
|
|
||||||
|
|
||||||
closure = function_offset ? g_signal_type_cclosure_new (object_type, function_offset) : NULL;
|
|
||||||
|
|
||||||
return g_signal_newv (name, object_type, (GSignalFlags)signal_flags, closure,
|
|
||||||
NULL, NULL, marshaller, return_val, n_params, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
guint
|
|
||||||
gtk_signal_new (const gchar *name,
|
|
||||||
GtkSignalRunType signal_flags,
|
|
||||||
GType object_type,
|
|
||||||
guint function_offset,
|
|
||||||
GSignalCMarshaller marshaller,
|
|
||||||
GType return_val,
|
|
||||||
guint n_params,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
GType *params;
|
|
||||||
guint signal_id;
|
|
||||||
|
|
||||||
if (n_params)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
guint i;
|
|
||||||
|
|
||||||
params = g_new (GType, n_params);
|
|
||||||
va_start (args, n_params);
|
|
||||||
for (i = 0; i < n_params; i++)
|
|
||||||
params[i] = va_arg (args, GType);
|
|
||||||
va_end (args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
params = NULL;
|
|
||||||
signal_id = gtk_signal_newv (name,
|
|
||||||
signal_flags,
|
|
||||||
object_type,
|
|
||||||
function_offset,
|
|
||||||
marshaller,
|
|
||||||
return_val,
|
|
||||||
n_params,
|
|
||||||
params);
|
|
||||||
g_free (params);
|
|
||||||
|
|
||||||
return signal_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gtk_signal_emit_stop_by_name (GtkObject *object,
|
|
||||||
const gchar *name)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GTK_IS_OBJECT (object));
|
|
||||||
|
|
||||||
g_signal_stop_emission (object, g_signal_lookup (name, G_OBJECT_TYPE (object)), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gtk_signal_connect_object_while_alive (GtkObject *object,
|
|
||||||
const gchar *name,
|
|
||||||
GCallback func,
|
|
||||||
GtkObject *alive_object)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GTK_IS_OBJECT (object));
|
|
||||||
|
|
||||||
g_signal_connect_closure_by_id (object,
|
|
||||||
g_signal_lookup (name, G_OBJECT_TYPE (object)), 0,
|
|
||||||
g_cclosure_new_object_swap (func, G_OBJECT (alive_object)),
|
|
||||||
FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gtk_signal_connect_while_alive (GtkObject *object,
|
|
||||||
const gchar *name,
|
|
||||||
GCallback func,
|
|
||||||
gpointer func_data,
|
|
||||||
GtkObject *alive_object)
|
|
||||||
{
|
|
||||||
GClosure *closure;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_OBJECT (object));
|
|
||||||
|
|
||||||
closure = g_cclosure_new (func, func_data, NULL);
|
|
||||||
g_object_watch_closure (G_OBJECT (alive_object), closure);
|
|
||||||
g_signal_connect_closure_by_id (object,
|
|
||||||
g_signal_lookup (name, G_OBJECT_TYPE (object)), 0,
|
|
||||||
closure,
|
|
||||||
FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
gulong
|
|
||||||
gtk_signal_connect_full (GtkObject *object,
|
|
||||||
const gchar *name,
|
|
||||||
GCallback func,
|
|
||||||
GtkCallbackMarshal unsupported,
|
|
||||||
gpointer data,
|
|
||||||
GDestroyNotify destroy_func,
|
|
||||||
gint object_signal,
|
|
||||||
gint after)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GTK_IS_OBJECT (object), 0);
|
|
||||||
g_return_val_if_fail (unsupported == NULL, 0);
|
|
||||||
|
|
||||||
return g_signal_connect_closure_by_id (object,
|
|
||||||
g_signal_lookup (name, G_OBJECT_TYPE (object)), 0,
|
|
||||||
(object_signal
|
|
||||||
? g_cclosure_new_swap
|
|
||||||
: g_cclosure_new) (func,
|
|
||||||
data,
|
|
||||||
(GClosureNotify) destroy_func),
|
|
||||||
after);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gtk_signal_compat_matched (GtkObject *object,
|
|
||||||
GCallback func,
|
|
||||||
gpointer data,
|
|
||||||
GSignalMatchType match,
|
|
||||||
guint action)
|
|
||||||
{
|
|
||||||
guint n_handlers;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_OBJECT (object));
|
|
||||||
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case 0: n_handlers = g_signal_handlers_disconnect_matched (object, match, 0, 0, NULL, (gpointer) func, data); break;
|
|
||||||
case 1: n_handlers = g_signal_handlers_block_matched (object, match, 0, 0, NULL, (gpointer) func, data); break;
|
|
||||||
case 2: n_handlers = g_signal_handlers_unblock_matched (object, match, 0, 0, NULL, (gpointer) func, data); break;
|
|
||||||
default: n_handlers = 0; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!n_handlers)
|
|
||||||
g_warning ("unable to find signal handler for object(%s:%p) with func(%p) and data(%p)",
|
|
||||||
G_OBJECT_TYPE_NAME (object), object, func, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
gtk_arg_to_value (GtkArg *arg,
|
|
||||||
GValue *value)
|
|
||||||
{
|
|
||||||
switch (G_TYPE_FUNDAMENTAL (arg->type))
|
|
||||||
{
|
|
||||||
case G_TYPE_CHAR: g_value_set_char (value, GTK_VALUE_CHAR (*arg)); break;
|
|
||||||
case G_TYPE_UCHAR: g_value_set_uchar (value, GTK_VALUE_UCHAR (*arg)); break;
|
|
||||||
case G_TYPE_BOOLEAN: g_value_set_boolean (value, GTK_VALUE_BOOL (*arg)); break;
|
|
||||||
case G_TYPE_INT: g_value_set_int (value, GTK_VALUE_INT (*arg)); break;
|
|
||||||
case G_TYPE_UINT: g_value_set_uint (value, GTK_VALUE_UINT (*arg)); break;
|
|
||||||
case G_TYPE_LONG: g_value_set_long (value, GTK_VALUE_LONG (*arg)); break;
|
|
||||||
case G_TYPE_ULONG: g_value_set_ulong (value, GTK_VALUE_ULONG (*arg)); break;
|
|
||||||
case G_TYPE_ENUM: g_value_set_enum (value, GTK_VALUE_ENUM (*arg)); break;
|
|
||||||
case G_TYPE_FLAGS: g_value_set_flags (value, GTK_VALUE_FLAGS (*arg)); break;
|
|
||||||
case G_TYPE_FLOAT: g_value_set_float (value, GTK_VALUE_FLOAT (*arg)); break;
|
|
||||||
case G_TYPE_DOUBLE: g_value_set_double (value, GTK_VALUE_DOUBLE (*arg)); break;
|
|
||||||
case G_TYPE_STRING: g_value_set_string (value, GTK_VALUE_STRING (*arg)); break;
|
|
||||||
case G_TYPE_BOXED: g_value_set_boxed (value, GTK_VALUE_BOXED (*arg)); break;
|
|
||||||
case G_TYPE_POINTER: g_value_set_pointer (value, GTK_VALUE_POINTER (*arg)); break;
|
|
||||||
case G_TYPE_OBJECT: g_value_set_object (value, GTK_VALUE_POINTER (*arg)); break;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
gtk_arg_static_to_value (GtkArg *arg,
|
|
||||||
GValue *value)
|
|
||||||
{
|
|
||||||
switch (G_TYPE_FUNDAMENTAL (arg->type))
|
|
||||||
{
|
|
||||||
case G_TYPE_CHAR: g_value_set_char (value, GTK_VALUE_CHAR (*arg)); break;
|
|
||||||
case G_TYPE_UCHAR: g_value_set_uchar (value, GTK_VALUE_UCHAR (*arg)); break;
|
|
||||||
case G_TYPE_BOOLEAN: g_value_set_boolean (value, GTK_VALUE_BOOL (*arg)); break;
|
|
||||||
case G_TYPE_INT: g_value_set_int (value, GTK_VALUE_INT (*arg)); break;
|
|
||||||
case G_TYPE_UINT: g_value_set_uint (value, GTK_VALUE_UINT (*arg)); break;
|
|
||||||
case G_TYPE_LONG: g_value_set_long (value, GTK_VALUE_LONG (*arg)); break;
|
|
||||||
case G_TYPE_ULONG: g_value_set_ulong (value, GTK_VALUE_ULONG (*arg)); break;
|
|
||||||
case G_TYPE_ENUM: g_value_set_enum (value, GTK_VALUE_ENUM (*arg)); break;
|
|
||||||
case G_TYPE_FLAGS: g_value_set_flags (value, GTK_VALUE_FLAGS (*arg)); break;
|
|
||||||
case G_TYPE_FLOAT: g_value_set_float (value, GTK_VALUE_FLOAT (*arg)); break;
|
|
||||||
case G_TYPE_DOUBLE: g_value_set_double (value, GTK_VALUE_DOUBLE (*arg)); break;
|
|
||||||
case G_TYPE_STRING: g_value_set_static_string (value, GTK_VALUE_STRING (*arg)); break;
|
|
||||||
case G_TYPE_BOXED: g_value_set_static_boxed (value, GTK_VALUE_BOXED (*arg)); break;
|
|
||||||
case G_TYPE_POINTER: g_value_set_pointer (value, GTK_VALUE_POINTER (*arg)); break;
|
|
||||||
case G_TYPE_OBJECT: g_value_set_object (value, GTK_VALUE_POINTER (*arg)); break;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
gtk_arg_set_from_value (GtkArg *arg,
|
|
||||||
GValue *value,
|
|
||||||
gboolean copy_string)
|
|
||||||
{
|
|
||||||
switch (G_TYPE_FUNDAMENTAL (arg->type))
|
|
||||||
{
|
|
||||||
case G_TYPE_CHAR: GTK_VALUE_CHAR (*arg) = g_value_get_char (value); break;
|
|
||||||
case G_TYPE_UCHAR: GTK_VALUE_UCHAR (*arg) = g_value_get_uchar (value); break;
|
|
||||||
case G_TYPE_BOOLEAN: GTK_VALUE_BOOL (*arg) = g_value_get_boolean (value); break;
|
|
||||||
case G_TYPE_INT: GTK_VALUE_INT (*arg) = g_value_get_int (value); break;
|
|
||||||
case G_TYPE_UINT: GTK_VALUE_UINT (*arg) = g_value_get_uint (value); break;
|
|
||||||
case G_TYPE_LONG: GTK_VALUE_LONG (*arg) = g_value_get_long (value); break;
|
|
||||||
case G_TYPE_ULONG: GTK_VALUE_ULONG (*arg) = g_value_get_ulong (value); break;
|
|
||||||
case G_TYPE_ENUM: GTK_VALUE_ENUM (*arg) = g_value_get_enum (value); break;
|
|
||||||
case G_TYPE_FLAGS: GTK_VALUE_FLAGS (*arg) = g_value_get_flags (value); break;
|
|
||||||
case G_TYPE_FLOAT: GTK_VALUE_FLOAT (*arg) = g_value_get_float (value); break;
|
|
||||||
case G_TYPE_DOUBLE: GTK_VALUE_DOUBLE (*arg) = g_value_get_double (value); break;
|
|
||||||
case G_TYPE_BOXED: GTK_VALUE_BOXED (*arg) = g_value_get_boxed (value); break;
|
|
||||||
case G_TYPE_POINTER: GTK_VALUE_POINTER (*arg) = g_value_get_pointer (value); break;
|
|
||||||
case G_TYPE_OBJECT: GTK_VALUE_POINTER (*arg) = g_value_get_object (value); break;
|
|
||||||
case G_TYPE_STRING: if (copy_string)
|
|
||||||
GTK_VALUE_STRING (*arg) = g_value_dup_string (value);
|
|
||||||
else
|
|
||||||
GTK_VALUE_STRING (*arg) = (char *) g_value_get_string (value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
gtk_argloc_set_from_value (GtkArg *arg,
|
|
||||||
GValue *value,
|
|
||||||
gboolean copy_string)
|
|
||||||
{
|
|
||||||
switch (G_TYPE_FUNDAMENTAL (arg->type))
|
|
||||||
{
|
|
||||||
case G_TYPE_CHAR: *GTK_RETLOC_CHAR (*arg) = g_value_get_char (value); break;
|
|
||||||
case G_TYPE_UCHAR: *GTK_RETLOC_UCHAR (*arg) = g_value_get_uchar (value); break;
|
|
||||||
case G_TYPE_BOOLEAN: *GTK_RETLOC_BOOL (*arg) = g_value_get_boolean (value); break;
|
|
||||||
case G_TYPE_INT: *GTK_RETLOC_INT (*arg) = g_value_get_int (value); break;
|
|
||||||
case G_TYPE_UINT: *GTK_RETLOC_UINT (*arg) = g_value_get_uint (value); break;
|
|
||||||
case G_TYPE_LONG: *GTK_RETLOC_LONG (*arg) = g_value_get_long (value); break;
|
|
||||||
case G_TYPE_ULONG: *GTK_RETLOC_ULONG (*arg) = g_value_get_ulong (value); break;
|
|
||||||
case G_TYPE_ENUM: *GTK_RETLOC_ENUM (*arg) = g_value_get_enum (value); break;
|
|
||||||
case G_TYPE_FLAGS: *GTK_RETLOC_FLAGS (*arg) = g_value_get_flags (value); break;
|
|
||||||
case G_TYPE_FLOAT: *GTK_RETLOC_FLOAT (*arg) = g_value_get_float (value); break;
|
|
||||||
case G_TYPE_DOUBLE: *GTK_RETLOC_DOUBLE (*arg) = g_value_get_double (value); break;
|
|
||||||
case G_TYPE_BOXED: *GTK_RETLOC_BOXED (*arg) = g_value_get_boxed (value); break;
|
|
||||||
case G_TYPE_POINTER: *GTK_RETLOC_POINTER (*arg) = g_value_get_pointer (value); break;
|
|
||||||
case G_TYPE_OBJECT: *GTK_RETLOC_POINTER (*arg) = g_value_get_object (value); break;
|
|
||||||
case G_TYPE_STRING: if (copy_string)
|
|
||||||
*GTK_RETLOC_STRING (*arg) = g_value_dup_string (value);
|
|
||||||
else
|
|
||||||
*GTK_RETLOC_STRING (*arg) = (char *) g_value_get_string (value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gtk_signal_emitv (GtkObject *object,
|
|
||||||
guint signal_id,
|
|
||||||
GtkArg *args)
|
|
||||||
{
|
|
||||||
GSignalQuery query;
|
|
||||||
GValue params[SIGNAL_MAX_PARAMS + 1] = { { 0, }, };
|
|
||||||
GValue rvalue = { 0, };
|
|
||||||
guint i;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_OBJECT (object));
|
|
||||||
|
|
||||||
g_signal_query (signal_id, &query);
|
|
||||||
g_return_if_fail (query.signal_id != 0);
|
|
||||||
g_return_if_fail (g_type_is_a (GTK_OBJECT_TYPE (object), query.itype));
|
|
||||||
g_return_if_fail (query.n_params < SIGNAL_MAX_PARAMS);
|
|
||||||
if (query.n_params > 0)
|
|
||||||
g_return_if_fail (args != NULL);
|
|
||||||
|
|
||||||
g_value_init (params + 0, GTK_OBJECT_TYPE (object));
|
|
||||||
g_value_set_object (params + 0, G_OBJECT (object));
|
|
||||||
for (i = 0; i < query.n_params; i++)
|
|
||||||
{
|
|
||||||
GValue *value = params + 1 + i;
|
|
||||||
GtkArg *arg = args + i;
|
|
||||||
|
|
||||||
g_value_init (value, arg->type & ~G_SIGNAL_TYPE_STATIC_SCOPE);
|
|
||||||
if (!gtk_arg_static_to_value (arg, value))
|
|
||||||
{
|
|
||||||
g_warning ("%s: failed to convert arg type `%s' to value type `%s'",
|
|
||||||
G_STRLOC, g_type_name (arg->type & ~G_SIGNAL_TYPE_STATIC_SCOPE),
|
|
||||||
g_type_name (G_VALUE_TYPE (value)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (query.return_type != G_TYPE_NONE)
|
|
||||||
g_value_init (&rvalue, query.return_type);
|
|
||||||
|
|
||||||
g_signal_emitv (params, signal_id, 0, &rvalue);
|
|
||||||
|
|
||||||
if (query.return_type != G_TYPE_NONE)
|
|
||||||
{
|
|
||||||
gtk_argloc_set_from_value (args + query.n_params, &rvalue, TRUE);
|
|
||||||
g_value_unset (&rvalue);
|
|
||||||
}
|
|
||||||
for (i = 0; i < query.n_params; i++)
|
|
||||||
g_value_unset (params + 1 + i);
|
|
||||||
g_value_unset (params + 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gtk_signal_emit (GtkObject *object,
|
|
||||||
guint signal_id,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
va_list var_args;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_OBJECT (object));
|
|
||||||
|
|
||||||
va_start (var_args, signal_id);
|
|
||||||
g_signal_emit_valist (G_OBJECT (object), signal_id, 0, var_args);
|
|
||||||
va_end (var_args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gtk_signal_emit_by_name (GtkObject *object,
|
|
||||||
const gchar *name,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
GSignalQuery query;
|
|
||||||
va_list var_args;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_OBJECT (object));
|
|
||||||
g_return_if_fail (name != NULL);
|
|
||||||
|
|
||||||
g_signal_query (g_signal_lookup (name, GTK_OBJECT_TYPE (object)), &query);
|
|
||||||
g_return_if_fail (query.signal_id != 0);
|
|
||||||
|
|
||||||
va_start (var_args, name);
|
|
||||||
g_signal_emit_valist (G_OBJECT (object), query.signal_id, 0, var_args);
|
|
||||||
va_end (var_args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gtk_signal_emitv_by_name (GtkObject *object,
|
|
||||||
const gchar *name,
|
|
||||||
GtkArg *args)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GTK_IS_OBJECT (object));
|
|
||||||
|
|
||||||
gtk_signal_emitv (object, g_signal_lookup (name, GTK_OBJECT_TYPE (object)), args);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define __GTK_SIGNAL_C__
|
|
||||||
#include "gtkaliasdef.c"
|
|
||||||
149
gtk/gtksignal.h
149
gtk/gtksignal.h
@ -1,149 +0,0 @@
|
|||||||
/* GTK - The GIMP Toolkit
|
|
||||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
|
||||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
||||||
* files for a list of changes. These files are distributed with
|
|
||||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef GTK_DISABLE_DEPRECATED
|
|
||||||
|
|
||||||
#ifndef __GTK_SIGNAL_H__
|
|
||||||
#define __GTK_SIGNAL_H__
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
#include <gtk/gtkmarshal.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define gtk_signal_default_marshaller g_cclosure_marshal_VOID__VOID
|
|
||||||
|
|
||||||
|
|
||||||
/* --- compat defines --- */
|
|
||||||
#define GTK_SIGNAL_OFFSET G_STRUCT_OFFSET
|
|
||||||
#define gtk_signal_lookup(name,object_type) \
|
|
||||||
g_signal_lookup ((name), (object_type))
|
|
||||||
#define gtk_signal_name(signal_id) \
|
|
||||||
g_signal_name (signal_id)
|
|
||||||
#define gtk_signal_emit_stop(object,signal_id) \
|
|
||||||
g_signal_stop_emission ((object), (signal_id), 0)
|
|
||||||
#define gtk_signal_connect(object,name,func,func_data) \
|
|
||||||
gtk_signal_connect_full ((object), (name), (func), NULL, (func_data), NULL, 0, 0)
|
|
||||||
#define gtk_signal_connect_after(object,name,func,func_data) \
|
|
||||||
gtk_signal_connect_full ((object), (name), (func), NULL, (func_data), NULL, 0, 1)
|
|
||||||
#define gtk_signal_connect_object(object,name,func,slot_object) \
|
|
||||||
gtk_signal_connect_full ((object), (name), (func), NULL, (slot_object), NULL, 1, 0)
|
|
||||||
#define gtk_signal_connect_object_after(object,name,func,slot_object) \
|
|
||||||
gtk_signal_connect_full ((object), (name), (func), NULL, (slot_object), NULL, 1, 1)
|
|
||||||
#define gtk_signal_disconnect(object,handler_id) \
|
|
||||||
g_signal_handler_disconnect ((object), (handler_id))
|
|
||||||
#define gtk_signal_handler_block(object,handler_id) \
|
|
||||||
g_signal_handler_block ((object), (handler_id))
|
|
||||||
#define gtk_signal_handler_unblock(object,handler_id) \
|
|
||||||
g_signal_handler_unblock ((object), (handler_id))
|
|
||||||
#define gtk_signal_disconnect_by_func(object,func,data) \
|
|
||||||
gtk_signal_compat_matched ((object), (func), (data), \
|
|
||||||
(GSignalMatchType)(G_SIGNAL_MATCH_FUNC | \
|
|
||||||
G_SIGNAL_MATCH_DATA), 0)
|
|
||||||
#define gtk_signal_disconnect_by_data(object,data) \
|
|
||||||
gtk_signal_compat_matched ((object), 0, (data), G_SIGNAL_MATCH_DATA, 0)
|
|
||||||
#define gtk_signal_handler_block_by_func(object,func,data) \
|
|
||||||
gtk_signal_compat_matched ((object), (func), (data), \
|
|
||||||
(GSignalMatchType)(G_SIGNAL_MATCH_FUNC | \
|
|
||||||
G_SIGNAL_MATCH_DATA), 1)
|
|
||||||
#define gtk_signal_handler_block_by_data(object,data) \
|
|
||||||
gtk_signal_compat_matched ((object), 0, (data), G_SIGNAL_MATCH_DATA, 1)
|
|
||||||
#define gtk_signal_handler_unblock_by_func(object,func,data) \
|
|
||||||
gtk_signal_compat_matched ((object), (func), (data), \
|
|
||||||
(GSignalMatchType)(G_SIGNAL_MATCH_FUNC | \
|
|
||||||
G_SIGNAL_MATCH_DATA), 2)
|
|
||||||
#define gtk_signal_handler_unblock_by_data(object,data) \
|
|
||||||
gtk_signal_compat_matched ((object), 0, (data), G_SIGNAL_MATCH_DATA, 2)
|
|
||||||
#define gtk_signal_handler_pending(object,signal_id,may_be_blocked) \
|
|
||||||
g_signal_has_handler_pending ((object), (signal_id), 0, (may_be_blocked))
|
|
||||||
#define gtk_signal_handler_pending_by_func(object,signal_id,may_be_blocked,func,data) \
|
|
||||||
(g_signal_handler_find ((object), \
|
|
||||||
(GSignalMatchType)(G_SIGNAL_MATCH_ID | \
|
|
||||||
G_SIGNAL_MATCH_FUNC | \
|
|
||||||
G_SIGNAL_MATCH_DATA | \
|
|
||||||
((may_be_blocked) ? 0 : G_SIGNAL_MATCH_UNBLOCKED)),\
|
|
||||||
(signal_id), 0, 0, (func), (data)) != 0)
|
|
||||||
|
|
||||||
|
|
||||||
/* --- compat functions --- */
|
|
||||||
guint gtk_signal_newv (const gchar *name,
|
|
||||||
GtkSignalRunType signal_flags,
|
|
||||||
GType object_type,
|
|
||||||
guint function_offset,
|
|
||||||
GSignalCMarshaller marshaller,
|
|
||||||
GType return_val,
|
|
||||||
guint n_args,
|
|
||||||
GType *args);
|
|
||||||
guint gtk_signal_new (const gchar *name,
|
|
||||||
GtkSignalRunType signal_flags,
|
|
||||||
GType object_type,
|
|
||||||
guint function_offset,
|
|
||||||
GSignalCMarshaller marshaller,
|
|
||||||
GType return_val,
|
|
||||||
guint n_args,
|
|
||||||
...);
|
|
||||||
void gtk_signal_emit_stop_by_name (GtkObject *object,
|
|
||||||
const gchar *name);
|
|
||||||
void gtk_signal_connect_object_while_alive (GtkObject *object,
|
|
||||||
const gchar *name,
|
|
||||||
GCallback func,
|
|
||||||
GtkObject *alive_object);
|
|
||||||
void gtk_signal_connect_while_alive (GtkObject *object,
|
|
||||||
const gchar *name,
|
|
||||||
GCallback func,
|
|
||||||
gpointer func_data,
|
|
||||||
GtkObject *alive_object);
|
|
||||||
gulong gtk_signal_connect_full (GtkObject *object,
|
|
||||||
const gchar *name,
|
|
||||||
GCallback func,
|
|
||||||
GtkCallbackMarshal unsupported,
|
|
||||||
gpointer data,
|
|
||||||
GDestroyNotify destroy_func,
|
|
||||||
gint object_signal,
|
|
||||||
gint after);
|
|
||||||
void gtk_signal_emitv (GtkObject *object,
|
|
||||||
guint signal_id,
|
|
||||||
GtkArg *args);
|
|
||||||
void gtk_signal_emit (GtkObject *object,
|
|
||||||
guint signal_id,
|
|
||||||
...);
|
|
||||||
void gtk_signal_emit_by_name (GtkObject *object,
|
|
||||||
const gchar *name,
|
|
||||||
...);
|
|
||||||
void gtk_signal_emitv_by_name (GtkObject *object,
|
|
||||||
const gchar *name,
|
|
||||||
GtkArg *args);
|
|
||||||
void gtk_signal_compat_matched (GtkObject *object,
|
|
||||||
GCallback func,
|
|
||||||
gpointer data,
|
|
||||||
GSignalMatchType match,
|
|
||||||
guint action);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __GTK_SIGNAL_H__ */
|
|
||||||
|
|
||||||
#endif /* GTK_DISABLE_DEPRECATED */
|
|
||||||
@ -45,7 +45,6 @@
|
|||||||
|
|
||||||
/* Not needed, retained for compatibility -Yosh */
|
/* Not needed, retained for compatibility -Yosh */
|
||||||
#include <gtk/gtkpixmap.h>
|
#include <gtk/gtkpixmap.h>
|
||||||
#include <gtk/gtksignal.h>
|
|
||||||
|
|
||||||
#endif /* GTK_DISABLE_DEPRECATED */
|
#endif /* GTK_DISABLE_DEPRECATED */
|
||||||
|
|
||||||
|
|||||||
@ -114,7 +114,6 @@ gtk_OBJECTS_deprecated = \
|
|||||||
gtkprogress.obj \
|
gtkprogress.obj \
|
||||||
gtktipsquery.obj \
|
gtktipsquery.obj \
|
||||||
gtkshow.obj \
|
gtkshow.obj \
|
||||||
gtksignal.obj \
|
|
||||||
gtkpixmap.obj \
|
gtkpixmap.obj \
|
||||||
gtkpreview.obj \
|
gtkpreview.obj \
|
||||||
gtkseparatortoolitem.obj \
|
gtkseparatortoolitem.obj \
|
||||||
@ -502,7 +501,6 @@ gtk_public_h_sources = \
|
|||||||
gtkseparatormenuitem.h \
|
gtkseparatormenuitem.h \
|
||||||
gtkseparatortoolitem.h \
|
gtkseparatortoolitem.h \
|
||||||
gtksettings.h \
|
gtksettings.h \
|
||||||
gtksignal.h \
|
|
||||||
gtksizegroup.h \
|
gtksizegroup.h \
|
||||||
gtksocket.h \
|
gtksocket.h \
|
||||||
gtkspinbutton.h \
|
gtkspinbutton.h \
|
||||||
@ -618,8 +616,6 @@ gtkmarshal.c : gtkmarshal.list
|
|||||||
|
|
||||||
gtktypefuncs.c : makefile.msc
|
gtktypefuncs.c : makefile.msc
|
||||||
echo /*none*/ > gtktypefuncs.c
|
echo /*none*/ > gtktypefuncs.c
|
||||||
gtksignal.obj : gtksignal.c gtkmarshal.c gtkmarshal.h
|
|
||||||
$(CC) $(CFLAGS) -GD -c -DGTK_COMPILATION -DG_LOG_DOMAIN=\"Gtk\" gtksignal.c
|
|
||||||
|
|
||||||
gtk-win32.res : gtk-win32.rc
|
gtk-win32.res : gtk-win32.rc
|
||||||
rc -DBUILDNUMBER=0 -r -fo gtk-win32.res gtk-win32.rc
|
rc -DBUILDNUMBER=0 -r -fo gtk-win32.res gtk-win32.rc
|
||||||
|
|||||||
Reference in New Issue
Block a user