Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.sao.ru/cats/~satr/GGAD/cha-main.html
Дата изменения: Wed Jul 12 23:54:24 2000 Дата индексирования: Tue Oct 2 01:30:43 2012 Кодировка: Поисковые слова: dark nebula |
GTK+ / Gnome Application Development | |||
---|---|---|---|
<<< Previous | Home | Next >>> |
This chapter describes Gnome's features for creating your application's main window, complete with menus and a toolbar.
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:
Menu and toolbars can be detached from the window, or rearranged in relation to one another and the main window contents.
Users can elect to disable detachable bars for all Gnome applications.
Users can choose whether to have small icons in the application's menus.
More options will probably be added in the future.
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.
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