The GnomeMDI object lets the application manage a
number of documents and displays their views in a configurable
fashion.
Once an instance of GnomeMDI has been created, you
can add documents to it using gnome_mdi_add_child() and add views
of these documents with gnome_mdi_add_view() routine. GnomeMDI
also provides means to create global menus and toolbar that apply
for each document and for merging document-specific menus with the
global ones. MDI automatically creates a menu containing a list of
all open documents. The global menus and toolbar can be created
using a template GnomeUIInfo structure or with a handler for
app_created signal which allows for customization of all
GnomeApp widgets that GnomeMDI creates.
The views are displayed in one of three modes that can be set using
gnome_mdi_set_mode() function:
GNOME_MDI_NOTEBOOK mode displays each view in a notebook page. The user can create
any number of notebooks, each within its toplevel GnomeApp and drag
pages from one to another, thus distributing the views between them in any
desired manner.
GNOME_MDI_TOPLEVEL mode displays each view in its own toplevel window.
GNOME_MDI_MODAL mode displays only a single view of a document.
GNOME_MDI_DEFAULT uses the mode that can be configured on a per-user
basis via the GNOME control center.
GnomeMDI can automatically save and restore its state and the state
of its children and layout, which is particularly useful to simplify implementation
of session managment.
This function sets the template for menus that appear in each toplevel
window to menu_template. For each new toplevel window created by the MDI,
this structure is copied, the menus are created with
gnome_app_create_menus_with_data() function with mdi as the callback
user data. Finally, the pointer to the copy is assigned to the new
toplevel window (a GnomeApp widget) and can be obtained by calling
&gnome_mdi_get_menubar_info.
This function sets the template for toolbar that appears in each toplevel
window to toolbar_template. For each new toplevel window created by the MDI,
this structure is copied, the toolbar is created with
gnome_app_create_toolbar_with_data() function with mdi as the callback
user data. Finally, the pointer to the copy is assigned to the new toplevel
window (a GnomeApp widget) and can be retrieved with a call to
&gnome_mdi_get_toolbar_info.
Sets the desired position of child-specific menus (which are added to and
removed from the main menus as views of different children are activated).
See gnome_app_find_menu_pos for details on menu paths.
mdi :
A pointer to a GnomeMDI object.
path :
A menu path where the child menus should be inserted.
Sets the position for insertion of menu items used to activate the MDI
children that were added to the MDI. See gnome_app_find_menu_pos for
details on menu paths. If the path is not set or set to NULL, these menu
items aren't going to be inserted in the MDI menu structure. Note that if
you want all menu items to be inserted in their own submenu, you have to
create that submenu (and leave it empty, of course).
mdi :
A pointer to a GnomeMDI object.
path :
A menu path where the child list menu should be inserted
Creates a new view of the child and adds it to the MDI. GnomeMDIChild
child has to be added to the MDI with a call to gnome_mdi_add_child
before its views are added to the MDI.
An "add_view" signal is emitted to the MDI after the view has been
created, but before it is shown and added to the MDI, with a pointer to
the created view as its parameter. The view is added to the MDI only if
the signal handler (if it exists) returns TRUE. If the handler returns
FALSE, the created view is destroyed and not added to the MDI.
mdi :
A pointer to a GnomeMDI object.
child :
A pointer to a child.
Returns :
TRUE if adding the view succeeded and FALSE otherwise.
Creates a new view of the child and adds it to the MDI; it behaves the
same way as gnome_mdi_add_view in GNOME_MDI_MODAL and GNOME_MDI_TOPLEVEL
modes, but in GNOME_MDI_NOTEBOOK mode, the view is added in a new
toplevel window unless the active one has no views in it.
mdi :
A pointer to a GnomeMDI object.
child :
A pointer to a GnomeMDIChild object to be added to the MDI.
Returns :
TRUE if adding the view succeeded and FALSE otherwise.
Removes a view from an MDI.
A "remove_view" signal is emitted to the MDI before actually removing
view. The view is removed only if the signal handler (if it exists and
the force is set to FALSE) returns TRUE.
Adds a new child to the MDI. No views are added: this has to be done with
a call to gnome_mdi_add_view.
First an "add_child" signal is emitted to the MDI with a pointer to the
child as its parameter. The child is added to the MDI only if the signal
handler (if it exists) returns TRUE. If the handler returns FALSE, the
child is not added to the MDI.
mdi :
A pointer to a GnomeMDI object.
child :
A pointer to a GnomeMDIChild to add to the MDI.
Returns :
TRUE if the child was added successfully and FALSE otherwise.
Removes a child and all of its views from the MDI.
A "remove_child" signal is emitted to the MDI with child as its parameter
before actually removing the child. The child is removed only if the signal
handler (if it exists and the force is set to FALSE) returns TRUE.
mdi :
A pointer to a GnomeMDI object.
child :
Child to remove.
force :
If TRUE, the "remove_child" signal is not emitted
Returns :
TRUE if the removal was successful and FALSE otherwise.
Removes all children and all views from the MDI.
A "remove_child" signal is emitted to the MDI for each child before
actually trying to remove any. If signal handlers for all children (if
they exist and the force is set to FALSE) return TRUE, all children
and their views are removed and none otherwise.
mdi :
A pointer to a GnomeMDI object.
force :
If TRUE, the "remove_child" signal is not emitted
Returns :
TRUE if the removal was successful and FALSE otherwise.
Opens a new toplevel window (unless in GNOME_MDI_MODAL mode and a
toplevel window is already open). This is usually used only for opening
the initial window on startup (just before calling gtkmain()) if no
windows were open because a session was restored or children were added
because of command line args).
Updates all notebook labels of child's views and their window titles
after its name changes. It is not required if gnome_mdi_child_set_name()
is used for setting the child's name.
Registers GtkObject object with MDI.
This is mostly intended for applications that open other windows besides
those opened by the MDI and want to continue to run even when no MDI
windows exist (an example of this would be GIMP's window with tools, if
the pictures were MDI children). As long as there is an object registered
with the MDI, the MDI will not destroy itself when the last of its windows
is closed. If no objects are registered, closing the last MDI window
results in MDI being destroyed.