?? cha-main.html
字號(hào):
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html> <head> <title> The Main Window: GnomeApp </title> <meta name="GENERATOR" content= "Modular DocBook HTML Stylesheet Version 1.45"> <link rel="HOME" title="GTK+ / Gnome Application Development" href="ggad.html"> <link rel="UP" title="Building a Gnome Application" href= "build-app.html"> <link rel="PREVIOUS" title="Session Management" href= "sec-sessionmanagement.html"> <link rel="NEXT" title="Menus and Toolbars with GnomeUIInfo" href="sec-gnomeuiinfo.html"> </head> <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink= "#840084" alink="#0000FF"> <div class="NAVHEADER"> <table width="100%" border="0" bgcolor="#ffffff" cellpadding= "1" cellspacing="0"> <tr> <th colspan="4" align="center"> <font color="#000000" size="2">GTK+ / Gnome Application Development</font> </th> </tr> <tr> <td width="25%" bgcolor="#ffffff" align="left"> <a href="sec-sessionmanagement.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-gnomeuiinfo.html"><font color="#0000ff" size="2"><b>Next >>></b></font></a> </td> </tr> </table> </div> <div class="CHAPTER"> <h1> <a name="CHA-MAIN">The Main Window: <tt class="CLASSNAME"> GnomeApp</tt></a> </h1> <div class="TOC"> <dl> <dt> <b>Table of Contents</b> </dt> <dt> <a href="cha-main.html#SEC-GNOMEAPP">The <tt class= "CLASSNAME">GnomeApp</tt> Widget</a> </dt> <dt> <a href="sec-gnomeuiinfo.html">Menus and Toolbars with <span class="STRUCTNAME">GnomeUIInfo</span></a> </dt> <dt> <a href="z91.html">Adding a Status Bar</a> </dt> <dt> <a href="sec-help.html">Online Help</a> </dt> <dt> <a href="z94.html">Finishing Touches</a> </dt> </dl> </div> <p> This chapter describes Gnome's features for creating your application's main window, complete with menus and a toolbar. </p> <div class="SECT1"> <h1 class="SECT1"> <a name="SEC-GNOMEAPP">The <tt class="CLASSNAME"> GnomeApp</tt> Widget</a> </h1> <p> All Gnome applications, excluding a few with special needs, use the <tt class="CLASSNAME">GnomeApp</tt> widget for their main window. <tt class="CLASSNAME"> GnomeApp</tt> is a subclass of <tt class="CLASSNAME"> GtkWindow</tt>; it extends the basic toplevel window with convenient menu and toolbar handling. A <tt class= "CLASSNAME">GnomeApp</tt> window is automatically user-configurable in several ways: </p> <ul> <li> <p> Menu and toolbars can be detached from the window, or rearranged in relation to one another and the main window contents. </p> </li> <li> <p> Users can elect to disable detachable bars for all Gnome applications. </p> </li> <li> <p> Users can choose whether to have small icons in the application's menus. </p> </li> </ul> <p> More options will probably be added in the future. </p> <div class="FIGURE"> <a name="Z88"></a> <p> <img src="figures/gnumeric.png"> </p> <p> <b>Figure 1. The Gnumeric spreadsheet, which uses the <tt class="CLASSNAME">GnomeApp</tt> widget</b> </p> </div> <p> <tt class="CLASSNAME">GnomeApp</tt> has the usual constructor function, shown in <a href= "cha-main.html#FL-GNOMEAPPNEW">Figure 2</a>. The first argument, <span class="STRUCTNAME">app_id</span>, is an internal name Gnome can use to work with this application. It should be the same as the <span class= "STRUCTNAME">app_id</span> passed to <tt class= "FUNCTION">gnome_init()</tt>; the name of the executable is a good choice. The second argument is simply a title for the application window; if you use <tt class= "FUNCTION">NULL</tt> here, the title will not be set. </p> <div class="FIGURE"> <a name="FL-GNOMEAPPNEW"></a> <div class="FUNCSYNOPSIS"> <a name="FL-GNOMEAPPNEW.SYNOPSIS"></a> <table border="0" bgcolor="#E0E0E0" width="100%"> <tr> <td><pre class="FUNCSYNOPSISINFO">#include <libgnomeui/gnome-app.h></pre> </td> </tr> </table> <p> <code><code class="FUNCDEF">GtkWidget* <tt class= "FUNCTION">gnome_app_new</tt></code>(gchar* <tt class="PARAMETER"><i>app_id</i></tt>, gchar* <tt class="PARAMETER"><i>title</i></tt>);</code> </p> </div> <p> <b>Figure 2. <tt class="CLASSNAME">GnomeApp</tt> Constructor</b> </p> </div> <p> <tt class="CLASSNAME">GnomeApp</tt> has a single "content area" in the center, where you place the main functionality of your application. On all four sides of this central area, you can add toolbars, menubars, and statusbars. <a href="cha-main.html#GNOMEAPP-CONTENTS"> Figure 3</a> lists the relevant functions. </p> <p> These functions should be self-explanatory. They simply install the widget you give them in the appropriate place on the <tt class="CLASSNAME">GnomeApp</tt>. There are easy ways to create the menubar, toolbar, and statusbar; the remainder of this chapter describes them. </p> <div class="FIGURE"> <a name="GNOMEAPP-CONTENTS"></a> <div class="FUNCSYNOPSIS"> <a name="GNOMEAPP-CONTENTS.SYNOPSIS"></a> <table border="0" bgcolor="#E0E0E0" width="100%"> <tr> <td><pre class="FUNCSYNOPSISINFO">#include <libgnomeui/gnome-app.h></pre> </td> </tr> </table> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION"> gnome_app_set_contents</tt></code>(GnomeApp* <tt class="PARAMETER"><i>app</i></tt>, GtkWidget* <tt class="PARAMETER"><i>contents</i></tt>);</code> </p> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION">gnome_app_set_menus</tt></code>(GnomeApp* <tt class="PARAMETER"><i>app</i></tt>, GtkMenuBar* <tt class="PARAMETER"><i>menubar</i></tt>);</code> </p> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION"> gnome_app_set_toolbar</tt></code>(GnomeApp* <tt class="PARAMETER"><i>app</i></tt>, GtkToolbar* <tt class="PARAMETER"><i>toolbar</i></tt>);</code> </p> <p> <code><code class="FUNCDEF">void <tt class= "FUNCTION"> gnome_app_set_statusbar</tt></code>(GnomeApp* <tt class="PARAMETER"><i>app</i></tt>, GtkWidget* <tt class="PARAMETER"><i>statusbar</i></tt>);</code> </p> </div> <p> <b>Figure 3. Adding Widgets to <tt class="CLASSNAME"> GnomeApp</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-sessionmanagement.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-gnomeuiinfo.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>Session Management</b></font> </td> <td colspan="2" align="right"> <font color="#000000" size="2"><b>Menus and Toolbars with <span class="STRUCTNAME"> GnomeUIInfo</span></b></font> </td> </tr> </table> </div> </body></html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -