Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.sao.ru/cats/~satr/GGAD/cha-main.html
Дата изменения: Wed Jul 12 23:54:24 2000
Дата индексирования: Tue Oct 2 01:30:43 2012
Кодировка:

Поисковые слова: п п п п п п п п п п п п п
The Main Window: GnomeApp

The Main Window: GnomeApp

Table of Contents
The GnomeApp Widget
Menus and Toolbars with GnomeUIInfo
Adding a Status Bar
Online Help
Finishing Touches

This chapter describes Gnome's features for creating your application's main window, complete with menus and a toolbar.

The GnomeApp Widget

All Gnome applications, excluding a few with special needs, use the GnomeApp widget for their main window. GnomeApp is a subclass of GtkWindow; it extends the basic toplevel window with convenient menu and toolbar handling. A GnomeApp window is automatically user-configurable in several ways:

More options will probably be added in the future.

Figure 1. The Gnumeric spreadsheet, which uses the GnomeApp widget

GnomeApp has the usual constructor function, shown in Figure 2. The first argument, app_id, is an internal name Gnome can use to work with this application. It should be the same as the app_id passed to gnome_init(); the name of the executable is a good choice. The second argument is simply a title for the application window; if you use NULL here, the title will not be set.

#include <libgnomeui/gnome-app.h>

GtkWidget* gnome_app_new(gchar* app_id, gchar* title);

Figure 2. GnomeApp Constructor

GnomeApp 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. Figure 3 lists the relevant functions.

These functions should be self-explanatory. They simply install the widget you give them in the appropriate place on the GnomeApp. There are easy ways to create the menubar, toolbar, and statusbar; the remainder of this chapter describes them.

#include <libgnomeui/gnome-app.h>

void gnome_app_set_contents(GnomeApp* app, GtkWidget* contents);

void gnome_app_set_menus(GnomeApp* app, GtkMenuBar* menubar);

void gnome_app_set_toolbar(GnomeApp* app, GtkToolbar* toolbar);

void gnome_app_set_statusbar(GnomeApp* app, GtkWidget* statusbar);

Figure 3. Adding Widgets to GnomeApp