⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gtk-general.html

📁 该压缩包包含了GTK+的大量API函数
💻 HTML
📖 第 1 页 / 共 5 页
字号:
NAME="AEN214"></A><H3><ANAME="GTK-INIT-CHECK"></A>gtk_init_check ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GBOOLEAN>gboolean</A>    gtk_init_check                  (int *argc,                                             char ***argv);</PRE></TD></TR></TABLE><P>This function does the same work as <TTCLASS="FUNCTION">gtk_init</TT> with only a single change: It does not terminate the program if the GUI can't be initialized. Instead it returns <TTCLASS="LITERAL">FALSE</TT> on failure.</P><P>This way the application can fall back to some other means of communication with the user - for example a curses or command line interface.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN223"></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>argc</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">A reference to the <TTCLASS="PARAMETER"><I>argc</I></TT> of the <TTCLASS="FUNCTION">main</TT> function.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>argv</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">A reference to the <TTCLASS="PARAMETER"><I>argv</I></TT> of the <TTCLASS="FUNCTION">main</TT> function.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">TRUE</TT> if the GUI has been successful initialized, <TTCLASS="LITERAL">FALSE</TT> otherwise.&#13;</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN246"></A><H3><ANAME="GTK-EXIT"></A>gtk_exit ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void        gtk_exit                        (<AHREF=../glib/glib-basic-types.html#GINT>gint</A> error_code);</PRE></TD></TR></TABLE><P>Terminate the program and return the given exit code to the caller. This function will shut down the GUI and free all resources allocated for GTK.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN252"></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>error_code</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">Return value to pass to the caller. This is dependend on thetarget system but at least on Unix systems <TTCLASS="LITERAL">0</TT> means success.&#13;</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN262"></A><H3><ANAME="GTK-EVENTS-PENDING"></A>gtk_events_pending ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GINT>gint</A>        gtk_events_pending              (void);</PRE></TD></TR></TABLE><P>Check if any events are pending. This can be used to update the GUI and invoke timeouts etc. while doing some time intensive computation.</P><DIVCLASS="EXAMPLE"><ANAME="AEN268"></A><P><B>Example 2.  Updating the GUI during a long computation</B></P><TABLEBORDER="0"BGCOLOR="#D8F8D8"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">	/* computation going on */...        while (<AHREF="gtk-general.html#GTK-EVENTS-PENDING">gtk_events_pending</A>())	  <AHREF="gtk-general.html#GTK-MAIN-ITERATION">gtk_main_iteration</A>();...	/* computation continued */</PRE></TD></TR></TABLE></DIV><DIVCLASS="INFORMALTABLE"><ANAME="AEN273"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">TRUE</TT> if any events are pending, <TTCLASS="LITERAL">FALSE</TT> otherwise.&#13;</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN284"></A><H3><ANAME="GTK-MAIN"></A>gtk_main ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void        gtk_main                        (void);</PRE></TD></TR></TABLE><P>Runs the main loop until <AHREF="gtk-general.html#GTK-MAIN-QUIT">gtk_main_quit</A>() is called. You can nest calls togtk_main. In that case <AHREF="gtk-general.html#GTK-MAIN-QUIT">gtk_main_quit</A>() will make the innerst invocationof the main loop return.</P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN291"></A><H3><ANAME="GTK-MAIN-LEVEL"></A>gtk_main_level ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GUINT>guint</A>       gtk_main_level                  (void);</PRE></TD></TR></TABLE><P>Ask for the current nesting level of the main loop. This can be usefulwhen calling gtk_quit_add.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN297"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the nesting level of the current invocation of the main loop.&#13;</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN306"></A><H3><ANAME="GTK-MAIN-QUIT"></A>gtk_main_quit ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void        gtk_main_quit                   (void);</PRE></TD></TR></TABLE><P>Makes the innermost invocation of the main loop return when it regains control.</P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN311"></A><H3><ANAME="GTK-MAIN-ITERATION"></A>gtk_main_iteration ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GINT>gint</A>        gtk_main_iteration              (void);</PRE></TD></TR></TABLE><P>Runs a single iteration of the mainloop. If no events are waiting to beprocessed GTK+ will block until the next event is noticed. If you don'twant to block look at gtk_main_iteration_do or check if any events arepending with gtk_events_pending first.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN317"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">TRUE</TT> if gtk_main_quit has been called for the innermost mainloop.&#13;</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN327"></A><H3><ANAME="GTK-MAIN-ITERATION-DO"></A>gtk_main_iteration_do ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GINT>gint</A>        gtk_main_iteration_do           (<AHREF=../glib/glib-basic-types.html#GBOOLEAN>gboolean</A> blocking);</PRE></TD></TR></TABLE><P>Run a single iteration of the mainloop. If no events are available eitherreturn or block dependend on the value of <TTCLASS="PARAMETER"><I>blocking</I></TT>. </P><DIVCLASS="INFORMALTABLE"><ANAME="AEN335"></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>blocking</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">TRUE</TT> if you want GTK+ to block if no events are pending.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"><TTCLASS="LITERAL">TRUE</TT> if gtk_main_quit has been called for the innermost mainloop.&#13;</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN350"></A><H3><ANAME="GTK-MAIN-DO-EVENT"></A>gtk_main_do_event ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void        gtk_main_do_event               (<AHREF=../gdk/gdk-event-structures.html#GDKEVENT>GdkEvent</A> *event);</PRE></TD></TR></TABLE><P>Process a single GDK event. This is public only to allow filtering of eventsbetween GDK and GTK. You will not usually need to call this function directly.</P><P>While you should not call this function directly, you might want to knowhow exactly events are handled. So here is what this function does with the event:</P><P></P><OLTYPE="1"><LI><P>  Compress enter/leave notify events. If the event passed build an   enter/leave pair together with the next event (peeked from Gdk)  both events are thrown away. This is to avoid a backlog of (de-)highlighting  widgets crossed by the pointer.</P></LI><LI><P>  Find the widget which got the event. If the widget can't be determined   the event is thrown away unless it belongs to a INCR transaction. In that  case it is passed to gtk_selection_incr_event.</P></LI><LI><P>  Then the event is passed on a stack so you can query the currently handled  event with gtk_get_current_event. </P></LI><LI><P>  The event is sent to a widget. If a grab is active all events for   widgets that are not in the contained in the grab widget are sent to the   latter with a few exceptions:   <P></P><UL><LI><P>    Deletion and destruction events are still sent to the event widget for    obvious reasons.  </P></LI><LI><P>    Events which directly relate to the visual representation of the event    widget.  </P></LI><LI><P>    Leave events are delivered to the event widget if there was an enter     event delivered to it before without the paired leave event.  </P></LI><LI><P>    Drag events are not redirected because it is unclear what the semantics    of that would be.  </P></LI></UL>  Another point of interest might be that all keypresses are first passed  through the key snooper functions if there are any. Read the description  of <AHREF="gtk-general.html#GTK-KEY-SNOOPER-INSTALL">gtk_key_snooper_install</A>() if you need this feature.</P></LI><LI><P>  After finishing the delivery the event is popped from the event stack.</P></LI></OL><DIVCLASS="INFORMALTABLE"><ANAME="AEN378"></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>event</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">An event to process (normally) passed by Gdk.&#13;</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN387"></A><H3><ANAME="GTKMODULEINITFUNC"></A>GtkModuleInitFunc ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void        (*GtkModuleInitFunc)            (<AHREF=../glib/glib-basic-types.html#GINT>gint</A> *argc,                                             <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> ***argv);</PRE></TD></TR></TABLE><P>Each GTK+ module must have a function gtk_module_init with this prototype.This function is called after loading the module with the argc and argv cleaned from any arguments that GTK+ handles itself.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN394"></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>argc</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">Pointer to the number of arguments remaining after gtk_init.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>argv</I></TT>&nbsp;:</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">Points to the argument vector. &#13;</TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN407"></A><H3><ANAME="GTK-TRUE"></A>gtk_true ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -