1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
|
<!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>
|