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

📄 sec-frames.html

📁 gtk的教材和问答集
💻 HTML
字号:
<HTML><HEAD><TITLE>Frames</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.49"><LINKREL="HOME"TITLE="GTK+ 1.2 Tutorial"HREF="gtk-tut.html"><LINKREL="UP"TITLE="Container Widgets"HREF="ch-containerwidgets.html"><LINKREL="PREVIOUS"TITLE="Layout Container"HREF="sec-layoutcontainer.html"><LINKREL="NEXT"TITLE="Aspect Frames"HREF="sec-aspectframes.html"></HEAD></head><body bgcolor="#FFFFFF" marginheight=0 marginwidth=0 width="100%"><table cellspacing=6 border=0 cellpadding=0 width="100%">  <tr>    <td bgcolor="#FFFFFF" valign=top nowrap>    <centeR><A HREF="/"><img src="/images/gtk-logo-rgb.gif" width=107 height=140 border=0></A>      <font face="helvetica,lucidia" color="#000000"><BR><BR><b>GTK+<BR>The GIMP Toolkit</b></center><BR><table width=100% cellspacing=0 cellpadding=2 border=0><tr><td bgcolor="#000000"><table width=100% cellspacing=0 cellpadding=4 border=0><tr><td bgcolor="#AAAAEE" nowrap><B>General</B></td></tr><tr><td bgcolor="#FFFFFF" nowrap><A HREF="/">Introduction</A><BR><A HREF="/screenshots/">Screenshots</A><br><A HREF="/download/">Download</A><br><A HREF="/mailinglists.html">Mailing Lists</A><BR><A HREF="/bindings.html">Language Bindings</A><BR><A HREF="http://gtk.themes.org/">Themes</A><BR><A HREF="/bugs.html">Bug Tracker</A><BR></td></tr></table></td></tr></table><BR>  <table width=100% cellspacing=0 cellpadding=2 border=0><tr><td bgcolor="#000000"><table width=100% cellspacing=0 cellpadding=4 border=0><tr><td bgcolor="#AAAAEE" nowrap><B>Documentation</B></td></tr><tr><td bgcolor="#FFFFFF" nowrap><A HREF="/faq/">FAQ</A><br><A HREF="/tutorial/">Tutorial</A><BR><A HREF="/api/">API Reference</A><br><A HREF="/books.html">Published Books</A><BR></td></tr></table></td></tr></table><BR>  <table width=100% cellspacing=0 cellpadding=2 border=0><tr><td bgcolor="#000000"><table width=100% cellspacing=0 cellpadding=4 border=0><tr><td bgcolor="#AAAAEE" nowrap><B>Projects</B></td></tr><tr><td bgcolor="#FFFFFF" nowrap><A HREF="http://www.pango.org/">Pango</A><BR><A HREF="http://sources.redhat.com/inti/">Inti</A><BR><A HREF="http://www.gnome.org/">GNOME</A><BR><A HREF="http://user.sgic.fi/~tml/gimp/win32/">GTK+ for Win32</A><br><A HREF="http://people.redhat.com/sopwith/gtkfb/">GtkFB (Framebuffer)</A><br><A HREF="http://www.directfb.org/gtk.xml">GTK+ on DirectFB</A><BR><A HREF="/beos/">GTK+ for BeOS</A></td></tr></table></td></tr></table><BR>  <table width=100% cellspacing=0 cellpadding=2 border=0><tr><td bgcolor="#000000"><table width=100% cellspacing=0 cellpadding=4 border=0><tr><td bgcolor="#AAAAEE" nowrap><B><B>Applications</B></B></td></tr><tr><td bgcolor="#FFFFFF" nowrap><A HREF="http://www.gimp.org/">GIMP</A><BR><A HREF="http://www.abiword.org/">Abiword</A><BR><A HREF="http://www.lysator.liu.se/~alla/dia/dia.html">Dia</A><BR><A HREF="http://glade.pn.org/">Glade</A><BR><A HREF="http://www.gnucash.org/">GnuCash</A><BR><A HREF="http://www.gnome.org/projects/gnumeric/">Gnumeric</A><BR><BR><A HREF="http://www.gnome.org/applist/">GNOME Software Map</A><br></td></tr></table></td></tr></table><BR>      </td>  <td bgcolor="#ffffff" valign=top width="99%"><font face="lucida,helvetica"><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">GTK+ 1.2 Tutorial</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="sec-layoutcontainer.html">&#60;&#60;&#60; Previous</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 10. Container Widgets</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="sec-aspectframes.html">Next &#62;&#62;&#62;</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="SEC-FRAMES">10.5. Frames</A></H1><P>Frames can be used to enclose one or a group of widgets with a boxwhich can optionally be labelled. The position of the label and thestyle of the box can be altered to suit.</P><P>A Frame can be created with the following function:</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">GtkWidget *gtk_frame_new( const gchar *label );</PRE></TD></TR></TABLE><P>The label is by default placed in the upper left hand corner of theframe. A value of NULL for the <TTCLASS="LITERAL">label</TT> argument will result in nolabel being displayed. The text of the label can be changed using thenext function.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_frame_set_label( GtkFrame    *frame,                          const gchar *label );</PRE></TD></TR></TABLE><P>The position of the label can be changed using this function:</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_frame_set_label_align( GtkFrame *frame,                                gfloat    xalign,                                gfloat    yalign );</PRE></TD></TR></TABLE><P><TTCLASS="LITERAL">xalign</TT> and <TTCLASS="LITERAL">yalign</TT> take values between 0.0 and 1.0. <TTCLASS="LITERAL">xalign</TT>indicates the position of the label along the top horizontal of theframe. <TTCLASS="LITERAL">yalign</TT> is not currently used. The default value of xalignis 0.0 which places the label at the left hand end of the frame.</P><P>The next function alters the style of the box that is used to outlinethe frame.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_frame_set_shadow_type( GtkFrame      *frame,                                GtkShadowType  type);</PRE></TD></TR></TABLE><P>The <TTCLASS="LITERAL">type</TT> argument can take one of the following values:</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">  GTK_SHADOW_NONE  GTK_SHADOW_IN  GTK_SHADOW_OUT  GTK_SHADOW_ETCHED_IN (the default)  GTK_SHADOW_ETCHED_OUT</PRE></TD></TR></TABLE><P>The following code example illustrates the use of the Frame widget.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">/* example-start frame frame.c */#include &#60;gtk/gtk.h&#62;int main( int   argc,          char *argv[] ){  /* GtkWidget is the storage type for widgets */  GtkWidget *window;  GtkWidget *frame;  GtkWidget *button;  gint i;  /* Initialise GTK */  gtk_init(&#38;argc, &#38;argv);      /* Create a new window */  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);  gtk_window_set_title(GTK_WINDOW(window), "Frame Example");  /* Here we connect the "destroy" event to a signal handler */   gtk_signal_connect (GTK_OBJECT (window), "destroy",		      GTK_SIGNAL_FUNC (gtk_main_quit), NULL);  gtk_widget_set_usize(window, 300, 300);  /* Sets the border width of the window. */  gtk_container_set_border_width (GTK_CONTAINER (window), 10);  /* Create a Frame */  frame = gtk_frame_new(NULL);  gtk_container_add(GTK_CONTAINER(window), frame);  /* Set the frame's label */  gtk_frame_set_label( GTK_FRAME(frame), "GTK Frame Widget" );  /* Align the label at the right of the frame */  gtk_frame_set_label_align( GTK_FRAME(frame), 1.0, 0.0);  /* Set the style of the frame */  gtk_frame_set_shadow_type( GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT);  gtk_widget_show(frame);    /* Display the window */  gtk_widget_show (window);      /* Enter the event loop */  gtk_main ();      return(0);}/* example-end */</PRE></TD></TR></TABLE></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="sec-layoutcontainer.html">&#60;&#60;&#60; Previous</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="gtk-tut.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="sec-aspectframes.html">Next &#62;&#62;&#62;</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Layout Container</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ch-containerwidgets.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Aspect Frames</TD></TR></TABLE></DIV>        </td>    </tr></table>  </td>  </tr></table></body></BODY></HTML>

⌨️ 快捷键说明

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