📄 hooks.sgml
字号:
</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GHookCheckFunc">GHookCheckFunc ()</title><programlisting><link linkend="gboolean">gboolean</link> (*GHookCheckFunc) (<link linkend="gpointer">gpointer</link> data);</programlisting><para>Defines the type of a hook function that can be invokedby <link linkend="g-hook-list-invoke-check">g_hook_list_invoke_check</link>().</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>data</parameter> :</entry><entry>the data field of the <link linkend="GHook">GHook</link> is passed to the hook function here.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>FALSE</literal> if the <link linkend="GHook">GHook</link> should be destroyed.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-list-init">g_hook_list_init ()</title><programlisting>void g_hook_list_init (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="guint">guint</link> hook_size);</programlisting><para>Initializes a <link linkend="GHookList">GHookList</link>.This must be called before the <link linkend="GHookList">GHookList</link> is used.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>hook_size</parameter> :</entry><entry>the size of each element in the <link linkend="GHookList">GHookList</link>, typically<literal>sizeof (GHook)</literal>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-list-invoke">g_hook_list_invoke ()</title><programlisting>void g_hook_list_invoke (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="gboolean">gboolean</link> may_recurse);</programlisting><para>Calls all of the <link linkend="GHook">GHook</link> functions in a <link linkend="GHookList">GHookList</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>may_recurse</parameter> :</entry><entry><literal>TRUE</literal> if functions which are already running (e.g. in anotherthread) can be called. If set to <literal>FALSE</literal>, these are skipped.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-list-invoke-check">g_hook_list_invoke_check ()</title><programlisting>void g_hook_list_invoke_check (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="gboolean">gboolean</link> may_recurse);</programlisting><para>Calls all of the <link linkend="GHook">GHook</link> functions in a <link linkend="GHookList">GHookList</link>.Any function which returns <literal>TRUE</literal> is removed from the <link linkend="GHookList">GHookList</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>may_recurse</parameter> :</entry><entry><literal>TRUE</literal> if functions which are already running (e.g. in anotherthread) can be called. If set to <literal>FALSE</literal>, these are skipped.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-list-marshal">g_hook_list_marshal ()</title><programlisting>void g_hook_list_marshal (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="gboolean">gboolean</link> may_recurse, <link linkend="GHookMarshaller">GHookMarshaller</link> marshaller, <link linkend="gpointer">gpointer</link> marshal_data);</programlisting><para>Calls a function on each valid <link linkend="GHook">GHook</link>. </para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>may_recurse</parameter> :</entry><entry><literal>TRUE</literal> if hooks which are currently running (e.g. in anotherthread) are considered valid. If set to <literal>FALSE</literal>, these are skipped.</entry></row><row><entry align="right"><parameter>marshaller</parameter> :</entry><entry>the function to call for each <link linkend="GHook">GHook</link>.</entry></row><row><entry align="right"><parameter>marshal_data</parameter> :</entry><entry>data to pass to <parameter>marshaller</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GHookMarshaller">GHookMarshaller ()</title><programlisting>void (*GHookMarshaller) (<link linkend="GHook">GHook</link> *hook, <link linkend="gpointer">gpointer</link> marshal_data);</programlisting><para>Defines the type of function used by <link linkend="g-hook-list-marshal">g_hook_list_marshal</link>().</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook</parameter> :</entry><entry>a <link linkend="GHook">GHook</link>.</entry></row><row><entry align="right"><parameter>marshal_data</parameter> :</entry><entry>user data.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-list-marshal-check">g_hook_list_marshal_check ()</title><programlisting>void g_hook_list_marshal_check (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="gboolean">gboolean</link> may_recurse, <link linkend="GHookCheckMarshaller">GHookCheckMarshaller</link> marshaller, <link linkend="gpointer">gpointer</link> marshal_data);</programlisting><para>Calls a function on each valid <link linkend="GHook">GHook</link> and destroys it if the function returns <literal>FALSE</literal>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>may_recurse</parameter> :</entry><entry><literal>TRUE</literal> if hooks which are currently running (e.g. in anotherthread) are considered valid. If set to <literal>FALSE</literal>, these are skipped.</entry></row><row><entry align="right"><parameter>marshaller</parameter> :</entry><entry>the function to call for each <link linkend="GHook">GHook</link>.</entry></row><row><entry align="right"><parameter>marshal_data</parameter> :</entry><entry>data to pass to <parameter>marshaller</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GHookCheckMarshaller">GHookCheckMarshaller ()</title><programlisting><link linkend="gboolean">gboolean</link> (*GHookCheckMarshaller) (<link linkend="GHook">GHook</link> *hook, <link linkend="gpointer">gpointer</link> marshal_data);</programlisting><para>Defines the type of function used by <link linkend="g-hook-list-marshal-check">g_hook_list_marshal_check</link>().</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook</parameter> :</entry><entry>a <link linkend="GHook">GHook</link>.</entry></row><row><entry align="right"><parameter>marshal_data</parameter> :</entry><entry>user data.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>FALSE</literal> if <parameter>hook</parameter> should be destroyed.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-list-clear">g_hook_list_clear ()</title><programlisting>void g_hook_list_clear (<link linkend="GHookList">GHookList</link> *hook_list);</programlisting><para>Removes all the <link linkend="GHook">GHook</link> elements from a <link linkend="GHookList">GHookList</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-alloc">g_hook_alloc ()</title><programlisting><link linkend="GHook">GHook</link>* g_hook_alloc (<link linkend="GHookList">GHookList</link> *hook_list);</programlisting><para>Allocates space for a <link linkend="GHook">GHook</link> and initializes it.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>a new <link linkend="GHook">GHook</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-append">g_hook_append()</title><programlisting>#define g_hook_append( hook_list, hook )</programlisting><para>Appends a <link linkend="GHook">GHook</link> onto the end of a <link linkend="GHookList">GHookList</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>hook</parameter> :</entry><entry>the <link linkend="GHook">GHook</link> to add to the end of <parameter>hook_list</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-prepend">g_hook_prepend ()</title><programlisting>void g_hook_prepend (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="GHook">GHook</link> *hook);</programlisting><para>Prepends a <link linkend="GHook">GHook</link> on the start of a <link linkend="GHookList">GHookList</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>hook</parameter> :</entry><entry>the <link linkend="GHook">GHook</link> to add to the start of <parameter>hook_list</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-insert-before">g_hook_insert_before ()</title><programlisting>void g_hook_insert_before (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="GHook">GHook</link> *sibling, <link linkend="GHook">GHook</link> *hook);</programlisting><para>Inserts a <link linkend="GHook">GHook</link> into a <link linkend="GHookList">GHookList</link>, before a given <link linkend="GHook">GHook</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>sibling</parameter> :</entry><entry>the <link linkend="GHook">GHook</link> to insert the new <link linkend="GHook">GHook</link> before.</entry></row><row><entry align="right"><parameter>hook</parameter> :</entry><entry>the <link linkend="GHook">GHook</link> to insert.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -