📄 gtkstatusbar.html
字号:
<HTML><HEAD><TITLE>GtkStatusbar</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.61"><LINKREL="HOME"TITLE="GTK+ Reference Manual"HREF="index.html"><LINKREL="UP"TITLE="GTK+ Widgets and Objects"HREF="gtkobjects.html"><LINKREL="PREVIOUS"TITLE="GtkSpinButton"HREF="gtkspinbutton.html"><LINKREL="NEXT"TITLE="GtkTable"HREF="gtktable.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"BGCOLOR="#000000"CELLPADDING="1"CELLSPACING="0"><TR><THCOLSPAN="4"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="5">GTK+ Reference Manual</FONT></TH></TR><TR><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="left"><AHREF="gtkspinbutton.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B><<< Previous Page</B></FONT></A></TD><TDWIDTH="25%"BGCOLOR="#0000C0"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="index.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Home</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#00C000"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="gtkobjects.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Up</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="right"><AHREF="gtktable.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Next Page >>></B></FONT></A></TD></TR></TABLE></DIV><H1><ANAME="GTKSTATUSBAR">GtkStatusbar</A></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN39747"></A><H2>Name</H2>GtkStatusbar -- report messages of minor importance to the user.</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN39750"></A><H2>Synopsis</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS"> #include <gtk/gtk.h>struct <AHREF="gtkstatusbar.html#GTKSTATUSBAR-STRUCT">GtkStatusbar</A>;struct <AHREF="gtkstatusbar.html#GTKSTATUSBARMSG">GtkStatusbarMsg</A>;<AHREF="gtkwidget.html">GtkWidget</A>* <AHREF="gtkstatusbar.html#GTK-STATUSBAR-NEW">gtk_statusbar_new</A> (void);<AHREF=../glib/glib-basic-types.html#GUINT>guint</A> <AHREF="gtkstatusbar.html#GTK-STATUSBAR-GET-CONTEXT-ID">gtk_statusbar_get_context_id</A> (<AHREF="gtkstatusbar.html">GtkStatusbar</A> *statusbar, const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *context_description);<AHREF=../glib/glib-basic-types.html#GUINT>guint</A> <AHREF="gtkstatusbar.html#GTK-STATUSBAR-PUSH">gtk_statusbar_push</A> (<AHREF="gtkstatusbar.html">GtkStatusbar</A> *statusbar, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> context_id, const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *text);void <AHREF="gtkstatusbar.html#GTK-STATUSBAR-POP">gtk_statusbar_pop</A> (<AHREF="gtkstatusbar.html">GtkStatusbar</A> *statusbar, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> context_id);void <AHREF="gtkstatusbar.html#GTK-STATUSBAR-REMOVE">gtk_statusbar_remove</A> (<AHREF="gtkstatusbar.html">GtkStatusbar</A> *statusbar, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> context_id, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> message_id); </PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN39773"></A><H2>Object Hierarchy</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS"> <AHREF="gtkobject.html">GtkObject</A> +----<AHREF="gtkwidget.html">GtkWidget</A> +----<AHREF="gtkcontainer.html">GtkContainer</A> +----<AHREF="gtkbox.html">GtkBox</A> +----<AHREF="gtkhbox.html">GtkHBox</A> +----GtkStatusbar</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN39781"></A><H2>Signal Prototypes</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS"> "<AHREF="gtkstatusbar.html#GTKSTATUSBAR-TEXT-PUSHED">text-pushed</A>" void user_function (<AHREF="gtkstatusbar.html">GtkStatusbar</A> *statusbar, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> context_id, <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *text, <AHREF=../glib/glib-basic-types.html#GPOINTER>gpointer</A> user_data);"<AHREF="gtkstatusbar.html#GTKSTATUSBAR-TEXT-POPPED">text-popped</A>" void user_function (<AHREF="gtkstatusbar.html">GtkStatusbar</A> *statusbar, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> context_id, <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *text, <AHREF=../glib/glib-basic-types.html#GPOINTER>gpointer</A> user_data);</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN39794"></A><H2>Description</H2><P>A <AHREF="gtkstatusbar.html">GtkStatusbar</A> is usually placed along the bottom of an application's main<AHREF="gtkwindow.html">GtkWindow</A>. It may provide a regular commentary of the application's status(as is usually the case in a web browser, for example), or may be used tosimply output a message when the status changes, (when an upload is completein an FTP client, for example).</P><P>Status bars in Gtk+ maintain a stack of messages. The message atthe top of the each bar's stack is the one that will currently be displayed.</P><P>Any messages added to a statusbar's stack must specify a <ICLASS="EMPHASIS">context_id</I>that is used to uniquely identify the source of a message. This context_id can be generated by <AHREF="gtkstatusbar.html#GTK-STATUSBAR-GET-CONTEXT-ID">gtk_statusbar_get_context_id</A>(), given a message and thestatusbar that it will be added to. Note that messages are stored in astack, and when choosing which message to display, the stack structure isadhered to, regardless of the context identifier of a message.</P><P>Status bars are created using <AHREF="gtkstatusbar.html#GTK-STATUSBAR-NEW">gtk_statusbar_new</A>().</P><P>Messages are added to the bar's stack with <AHREF="gtkstatusbar.html#GTK-STATUSBAR-PUSH">gtk_statusbar_push</A>().</P><P>The message at the top of the stack can be removed using <AHREF="gtkstatusbar.html#GTK-STATUSBAR-POP">gtk_statusbar_pop</A>(). A message can be removed from anywhere in the stack if it's message_id was recorded at the time it was added. This is done using <AHREF="gtkstatusbar.html#GTK-STATUSBAR-REMOVE">gtk_statusbar_remove</A>().</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN39810"></A><H2>Details</H2><DIVCLASS="REFSECT2"><ANAME="AEN39812"></A><H3><ANAME="GTKSTATUSBAR-STRUCT"></A>struct GtkStatusbar</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">struct GtkStatusbar;</PRE></TD></TR></TABLE><P>Contains private data that should be modified with the functions described below.</P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN39817"></A><H3><ANAME="GTKSTATUSBARMSG"></A>struct GtkStatusbarMsg</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">struct GtkStatusbarMsg{ gchar *text; guint context_id; guint message_id;};</PRE></TD></TR></TABLE><P>Holds the data for a statusbar message. <TTCLASS="STRUCTFIELD"><I>text</I></TT> holds the actual text string. <TTCLASS="STRUCTFIELD"><I>context_id</I></TT> is the context that this message is associated with, and <TTCLASS="STRUCTFIELD"><I>message_id</I></TT> is this particular message's identifier. However, these fields should not be modified directly.</P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN39825"></A><H3><ANAME="GTK-STATUSBAR-NEW"></A>gtk_statusbar_new ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF="gtkwidget.html">GtkWidget</A>* gtk_statusbar_new (void);</PRE></TD></TR></TABLE><P>Creates a new <AHREF="gtkstatusbar.html">GtkStatusbar</A> ready for messages.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN39832"></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 new <AHREF="gtkstatusbar.html">GtkStatusbar</A>. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN39842"></A><H3><ANAME="GTK-STATUSBAR-GET-CONTEXT-ID"></A>gtk_statusbar_get_context_id ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GUINT>guint</A> gtk_statusbar_get_context_id (<AHREF="gtkstatusbar.html">GtkStatusbar</A> *statusbar, const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *context_description);</PRE></TD></TR></TABLE><P>Returns a new context identifier, given a description of the actual context.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN39850"></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>statusbar</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a <AHREF="gtkstatusbar.html">GtkStatusbar</A>.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>context_description</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">textual description of what context the new message isbeing used in.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">an integer id. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN39868"></A><H3><ANAME="GTK-STATUSBAR-PUSH"></A>gtk_statusbar_push ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GUINT>guint</A> gtk_statusbar_push (<AHREF="gtkstatusbar.html">GtkStatusbar</A> *statusbar, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> context_id, const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *text);</PRE></TD></TR></TABLE><P>Pushes a new message onto a statusbar's stack.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN39877"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TD
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -