📄 gtk-signals.html
字号:
><HR><DIVCLASS="REFSECT2"><ANAME="AEN7981"></A><H3><ANAME="GTKSIGNALQUERY"></A>struct GtkSignalQuery</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">struct GtkSignalQuery{ GtkType object_type; guint signal_id; const gchar *signal_name; guint is_user_signal : 1; GtkSignalRunType signal_flags; GtkType return_val; guint nparams; const GtkType *params;};</PRE></TD></TR></TABLE><P>This structure contains all the information about a particularsignal: its name, the type it affects, the signature of the handlers,and its unique identifying integer.</P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN7986"></A><H3><ANAME="GTKSIGNALRUNTYPE"></A>enum GtkSignalRunType</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">typedef enum /*< flags >*/{ GTK_RUN_FIRST = 1 << 0, GTK_RUN_LAST = 1 << 1, GTK_RUN_BOTH = (GTK_RUN_FIRST | GTK_RUN_LAST), GTK_RUN_NO_RECURSE = 1 << 2, GTK_RUN_ACTION = 1 << 3, GTK_RUN_NO_HOOKS = 1 << 4} GtkSignalRunType;</PRE></TD></TR></TABLE><P>These configure the signal's emission. They controlwhether the signal can be emitted recursively on an objectandwhether to run the default method before or after the user-defined handlers.</P><P></P><DIVCLASS="VARIABLELIST"><DL><DT>GTK_RUN_FIRST</DT><DD><P>Run the default handler before the connected user-definedhandlers.</P></DD><DT>GTK_RUN_LAST</DT><DD><P>Run the default handler after the connecteduser-defined handlers.(Handlers registered as "after" always run after the default handler though)</P></DD><DT>GTK_RUN_BOTH</DT><DD><P>Run the default handler twice,once before the user-defined handlers,andonce after.</P></DD><DT>GTK_RUN_NO_RECURSE</DT><DD><P>Whether to prevent a handler or hookfrom reemitting the signal from within itself.Attempts toemit the signal while it is running will result in the signalemission being restarted once it is done with the current processing.</P><P>You must becareful to avoid having two handlers endlessly reemitting signals,<AHREF="gtk-signals.html#GTK-SIGNAL-N-EMISSIONS">gtk_signal_n_emissions</A>() can be helpful.</P></DD><DT>GTK_RUN_ACTION</DT><DD><P>The signal is an action you can invoke without any particular setup or cleanup.The signal is treated no differently, but someother code can determine if the signal is appropriate todelegate to user control. For example, key binding setsonly allow bindings of ACTION signals to keystrokes.</P></DD><DT>GTK_RUN_NO_HOOKS</DT><DD><P>This prevents the connection of emission hooksto the signal.</P></DD></DL></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN8018"></A><H3><ANAME="GTK-SIGNAL-INIT"></A>gtk_signal_init ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_signal_init (void);</PRE></TD></TR></TABLE><P></P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN8023"></A><H3><ANAME="GTK-SIGNAL-NEW"></A>gtk_signal_new ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GUINT>guint</A> gtk_signal_new (const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *name, <AHREF="gtk-signals.html#GTKSIGNALRUNTYPE">GtkSignalRunType</A> signal_flags, <AHREF="gtk-types.html#GTKTYPE">GtkType</A> object_type, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> function_offset, <AHREF="gtk-types.html#GTKSIGNALMARSHALLER">GtkSignalMarshaller</A> marshaller, <AHREF="gtk-types.html#GTKTYPE">GtkType</A> return_val, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> nparams, ...);</PRE></TD></TR></TABLE><P>Create a new signal type. (This is usually done in theclass initializer.)</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN8036"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>name</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the event name for the signal, e.g. "clicked".</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>signal_flags</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a combination of GTK_RUN flagsspecifying detail of when the default handler is to be invoked.You should at least specify GTK_RUN_FIRSTor GTK_RUN_LAST.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>object_type</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the type of object this signal pertains to.It will also pertain to derivers of this type automatically.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>function_offset</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">How many bytes the function pointer is inthe class structure for this type. Used to invoke a classmethod generically.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>marshaller</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the function to translate between an arrayof GtkArgs and the native calling convention. Usually theyare identified just by the type of arguments they take:for example, gtk_marshal_BOOL__STRING() describes a marshallerwhich takes a string and returns a boolean value.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>return_val</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the type of return value, or GTK_TYPE_NONE for a signalwithout a return value.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>nparams</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the number of parameter the handlers may take.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>...</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a list of GTK_TYPE_*, one for each parameter.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the signal id. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN8080"></A><H3><ANAME="GTK-SIGNAL-NEWV"></A>gtk_signal_newv ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GUINT>guint</A> gtk_signal_newv (const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *name, <AHREF="gtk-signals.html#GTKSIGNALRUNTYPE">GtkSignalRunType</A> signal_flags, <AHREF="gtk-types.html#GTKTYPE">GtkType</A> object_type, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> function_offset, <AHREF="gtk-types.html#GTKSIGNALMARSHALLER">GtkSignalMarshaller</A> marshaller, <AHREF="gtk-types.html#GTKTYPE">GtkType</A> return_val, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> nparams, <AHREF="gtk-types.html#GTKTYPE">GtkType</A> *params);</PRE></TD></TR></TABLE><P>Create a new signal type. (This is usually done in aclass initializer.)</P><P>This function take the types as an array, instead of a listfollowing the arguments. Otherwise the same as <AHREF="gtk-signals.html#GTK-SIGNAL-NEW">gtk_signal_new</A>().</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN8096"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>name</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the name of the signal to create.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>signal_flags</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">see <AHREF="gtk-signals.html#GTK-SIGNAL-NEW">gtk_signal_new</A>().</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>object_type</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the type of GtkObject to associate the signal with.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>function_offset</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">how many bytes the function pointer is inthe class structure for this type.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>marshaller</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>return_val</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the type of the return value, or GTK_TYPE_NONE ifyou don't want a return value.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>nparams</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the number of parameters to the user-defined handlers.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>params</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">an array of GtkTypes, describing the prototype tothe callbacks.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the signal id. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN8138"></A><H3><ANAME="GTK-SIGNAL-LOOKUP"></A>gtk_signal_lookup ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GUINT>guint</A> gtk_signal_lookup (const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *name, <AHREF="gtk-types.html#GTKTYPE">GtkType</A> object_type);</PRE></TD></TR></TABLE><P>Given the name of the signal and the type of object it connectsto, get the signal's identifying integer. Emitting the signalby number is somewhat faster than using the name each time.</P><P>It also tries the ancestors of the given type.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN8147"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>name</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the signal's name, e.g. clicked.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>object_type</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the type that the signal operates on, e.g. GTK_TYPE_BUTTON.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TD
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -