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

📄 sec-notebooks.html

📁 gtk 开发手册和参考文档。 包括gtk glib gdk等
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<HTML><HEAD><TITLE>Notebooks</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="Toolbar"HREF="sec-toolbar.html"><LINKREL="NEXT"TITLE="CList Widget"HREF="ch-clistwidget.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-toolbar.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="ch-clistwidget.html">Next &#62;&#62;&#62;</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="SEC-NOTEBOOKS">10.12. Notebooks</A></H1><P>The NoteBook Widget is a collection of "pages" that overlap eachother, each page contains different information with only one pagevisible at a time. This widget has become more common lately in GUIprogramming, and it is a good way to show blocks of similarinformation that warrant separation in their display.</P><P>The first function call you will need to know, as you can probablyguess by now, is used to create a new notebook widget.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">GtkWidget *gtk_notebook_new( void );</PRE></TD></TR></TABLE><P>Once the notebook has been created, there are a number of functionsthat operate on the notebook widget. Let's look at them individually.</P><P>The first one we will look at is how to position the page indicators.These page indicators or "tabs" as they are referred to, can bepositioned in four ways: top, bottom, left, or right.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_notebook_set_tab_pos( GtkNotebook     *notebook,                               GtkPositionType  pos );</PRE></TD></TR></TABLE><P>GtkPositionType will be one of the following, which are pretty selfexplanatory:</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">  GTK_POS_LEFT  GTK_POS_RIGHT  GTK_POS_TOP  GTK_POS_BOTTOM</PRE></TD></TR></TABLE><P><TTCLASS="LITERAL">GTK_POS_TOP</TT> is the default.</P><P>Next we will look at how to add pages to the notebook. There are threeways to add pages to the NoteBook. Let's look at the first twotogether as they are quite similar.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_notebook_append_page( GtkNotebook *notebook,                               GtkWidget   *child,                               GtkWidget   *tab_label );void gtk_notebook_prepend_page( GtkNotebook *notebook,                                GtkWidget   *child,                                GtkWidget   *tab_label );</PRE></TD></TR></TABLE><P>These functions add pages to the notebook by inserting them from theback of the notebook (append), or the front of the notebook (prepend).<TTCLASS="LITERAL">child</TT> is the widget that is placed within the notebook page, and<TTCLASS="LITERAL">tab_label</TT> is the label for the page being added. The <TTCLASS="LITERAL">child</TT>widget must be created separately, and is typically a set of optionssetup witin one of the other container widgets, such as a table.</P><P>The final function for adding a page to the notebook contains all ofthe properties of the previous two, but it allows you to specify whatposition you want the page to be in the notebook.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_notebook_insert_page( GtkNotebook *notebook,                               GtkWidget   *child,                               GtkWidget   *tab_label,                               gint         position );</PRE></TD></TR></TABLE><P>The parameters are the same as _append_ and _prepend_ except itcontains an extra parameter, <TTCLASS="LITERAL">position</TT>.  This parameter is used tospecify what place this page will be inserted into the first pagehaving position zero.</P><P>Now that we know how to add a page, lets see how we can remove a pagefrom the notebook.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_notebook_remove_page( GtkNotebook *notebook,                               gint         page_num );</PRE></TD></TR></TABLE><P>This function takes the page specified by <TTCLASS="LITERAL">page_num</TT> and removes itfrom the widget pointed to by <TTCLASS="LITERAL">notebook</TT

⌨️ 快捷键说明

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