📄 z91.html
字号:
refresh (the next time you push, pop, or set the default), the text disappears forever, replaced by the top of the stack. </p> <p> <a href="z91.html#FL-APPBARTEXT">Figure 8</a> lists the functions to manipulate the status text. <tt class= "FUNCTION">gnome_appbar_set_status()</tt> is used to set the transient status text; <tt class="FUNCTION"> gnome_appbar_refresh()</tt> forces a refresh without changing the stack---this is useful to be sure any transient text has been cleared. The other functions should be obvious. </p> <p> Note that you can use the <tt class="CLASSNAME"> GnomeAppBar</tt> as a simple label---one message at a time, always replacing the previous message---just stick to either setting the default or setting the transient text, and never use the stack. </p> <div class="FIGURE"> <a name="FL-APPBARTEXT"></a> <div class="FUNCSYNOPSIS"> <a name="FL-APPBARTEXT.SYNOPSIS"></a> <table border="0" bgcolor="#E0E0E0" width="100%"> <tr> <td><pre class="FUNCSYNOPSISINFO">#include <libgnomeui/gnome-appbar.h></pre> </td> </tr> </table> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION"> gnome_appbar_set_status</tt></code>(GnomeAppBar* <tt class="PARAMETER"><i>appbar</i></tt>, const gchar* <tt class="PARAMETER"><i>status</i></tt>);</code> </p> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION"> gnome_appbar_set_default</tt></code>(GnomeAppBar* <tt class="PARAMETER"><i>appbar</i></tt>, const gchar* <tt class="PARAMETER"><i> default_status</i></tt>);</code> </p> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION">gnome_appbar_push</tt></code>(GnomeAppBar* <tt class="PARAMETER"><i>appbar</i></tt>, const gchar* <tt class="PARAMETER"><i> status</i></tt>);</code> </p> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION">gnome_appbar_pop</tt></code>(GnomeAppBar* <tt class="PARAMETER"><i>appbar</i></tt>);</code> </p> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION"> gnome_appbar_clear_stack</tt></code>(GnomeAppBar* <tt class="PARAMETER"><i>appbar</i></tt>);</code> </p> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION"> gnome_appbar_refresh</tt></code>(GnomeAppBar* <tt class="PARAMETER"><i>appbar</i></tt>);</code> </p> </div> <p> <b>Figure 8. Setting <tt class="CLASSNAME"> GnomeAppBar</tt> Text</b> </p> </div> </div> <div class="SECT2"> <h2 class="SECT2"> <a name="SEC-GTKSTATUSBAR"><tt class="CLASSNAME"> GtkStatusbar</tt></a> </h2> <p> <tt class="CLASSNAME">GtkStatusbar</tt> has no default text or "transient" text, as in <tt class="CLASSNAME"> GnomeAppBar</tt>; it only has a message stack. However, each message is tagged with a "context" identified by a string. When you pop a message off the stack, you must specify a context; the topmost message <i class= "EMPHASIS">in that context</i> is popped. If there are no messages in the context you specify, no text is popped. In essence, the <tt class="CLASSNAME">GtkStatusbar</tt> "pop" operation works only within namespaces. There's no way to unconditionally pop all messages or unconditionally pop the topmost message. </p> <p> In principle this lets different parts of the program use the statusbar without interfering with one another. However, in my experience there's no need for this. For example, Netscape doesn't even have a stack for its statusbar; its statusbar is simply a label. In general it is poor interface design to make anything <i class= "EMPHASIS">essential</i> appear in the statusbar, since the user might not notice it. Accidentally deleting a message should not be a major worry. </p> <p> <a href="z91.html#FL-STATUSBAR">Figure 9</a> shows the <tt class="CLASSNAME">GtkStatusbar</tt> functions. </p> <p> To use the statusbar: </p> <ol type="1"> <li> <p> First obtain a context ID with <tt class="FUNCTION"> gtk_statusbar_get_context_id()</tt>; the <span class= "STRUCTNAME">context_description</span> argument can be any string you like. </p> </li> <li> <p> Push a message onto the statusbar using <tt class= "FUNCTION">gtk_statusbar_push()</tt>; the message is tagged with the given context ID. The return value is a message ID you can use to remove the message. (Unlike <tt class="CLASSNAME">GnomeAppBar</tt>, <tt class="CLASSNAME">GtkStatusbar</tt> lets you remove a message that isn't on top of the stack.) </p> </li> <li> <p> Eventually remove the message with <tt class= "FUNCTION">gtk_statusbar_remove()</tt> or <tt class= "FUNCTION">gtk_statusbar_pop()</tt>. The former refers to a specific message by ID, the latter removes the topmost message in the supplied context. </p> </li> </ol> <p> Note that <tt class="FUNCTION">gtk_statusbar_push()</tt> pushes a message on top of all other messages, even those in other contexts; but <tt class="FUNCTION"> gtk_statusbar_pop()</tt> will only pop from the context supplied. Contexts do not refer to separate stacks, they merely restrict which messages you are permitted to pop. </p> <div class="FIGURE"> <a name="FL-STATUSBAR"></a> <div class="FUNCSYNOPSIS"> <a name="FL-STATUSBAR.SYNOPSIS"></a> <table border="0" bgcolor="#E0E0E0" width="100%"> <tr> <td><pre class="FUNCSYNOPSISINFO">#include <gtk/gtkstatusbar.h></pre> </td> </tr> </table> <p> <code><code class="FUNCDEF">GtkWidget* <tt class= "FUNCTION"> gtk_statusbar_new</tt></code>(void);</code> </p> <p> <code><code class="FUNCDEF">guint <tt class= "FUNCTION"> gtk_statusbar_get_context_id</tt></code>(GtkStatusbar* <tt class="PARAMETER"><i>statusbar</i></tt>, const gchar* <tt class="PARAMETER"><i> context_description</i></tt>);</code> </p> <p> <code><code class="FUNCDEF">guint <tt class= "FUNCTION"> gtk_statusbar_push</tt></code>(GtkStatusbar* <tt class="PARAMETER"><i>statusbar</i></tt>, guint <tt class="PARAMETER"><i>context_id</i></tt>, const gchar* <tt class="PARAMETER"><i> text</i></tt>);</code> </p> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION"> gtk_statusbar_pop</tt></code>(GtkStatusbar* <tt class="PARAMETER"><i>statusbar</i></tt>, guint <tt class="PARAMETER"><i>context_id</i></tt>);</code> </p> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION"> gtk_statusbar_remove</tt></code>(GtkStatusbar* <tt class="PARAMETER"><i>statusbar</i></tt>, guint <tt class="PARAMETER"><i>context_id</i></tt>, guint <tt class="PARAMETER"><i>message_id</i></tt>);</code> </p> </div> <p> <b>Figure 9. <tt class="CLASSNAME"> GtkStatusbar</tt></b> </p> </div> </div> </div> <div class="NAVFOOTER"> <br> <br> <table width="100%" border="0" bgcolor="#ffffff" cellpadding= "1" cellspacing="0"> <tr> <td width="25%" bgcolor="#ffffff" align="left"> <a href="sec-gnomeuiinfo.html"><font color="#0000ff" size="2"><b><<< Previous</b></font></a> </td> <td width="25%" colspan="2" bgcolor="#ffffff" align= "center"> <font color="#0000ff" size="2"><b><a href="ggad.html"> <font color="#0000ff" size="2"><b> Home</b></font></a></b></font> </td> <td width="25%" bgcolor="#ffffff" align="right"> <a href="sec-help.html"><font color="#0000ff" size="2"> <b>Next >>></b></font></a> </td> </tr> <tr> <td colspan="2" align="left"> <font color="#000000" size="2"><b>Menus and Toolbars with <span class="STRUCTNAME"> GnomeUIInfo</span></b></font> </td> <td colspan="2" align="right"> <font color="#000000" size="2"><b>Online Help</b></font> </td> </tr> </table> </div> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -