## GnomeMDI

GnomeMDI

## Synopsis

    #include <libgnomeui/libgnomeui.h>

    enum                GnomeMDIMode;
                        GnomeMDI;
    GtkObject *         gnome_mdi_new                       (const gchar *appname,
                                                             const gchar *title);
    void                gnome_mdi_set_mode                  (GnomeMDI *mdi,
                                                             GnomeMDIMode mode);
    void                gnome_mdi_set_menubar_template      (GnomeMDI *mdi,
                                                             GnomeUIInfo *menu_tmpl);
    void                gnome_mdi_set_toolbar_template      (GnomeMDI *mdi,
                                                             GnomeUIInfo *tbar_tmpl);
    void                gnome_mdi_set_child_menu_path       (GnomeMDI *mdi,
                                                             const gchar *path);
    void                gnome_mdi_set_child_list_path       (GnomeMDI *mdi,
                                                             const gchar *path);
    gint                gnome_mdi_add_view                  (GnomeMDI *mdi,
                                                             GnomeMDIChild *child);
    gint                gnome_mdi_add_toplevel_view         (GnomeMDI *mdi,
                                                             GnomeMDIChild *child);
    gint                gnome_mdi_remove_view               (GnomeMDI *mdi,
                                                             GtkWidget *view,
                                                             gint force);
    GtkWidget *         gnome_mdi_get_active_view           (GnomeMDI *mdi);
    void                gnome_mdi_set_active_view           (GnomeMDI *mdi,
                                                             GtkWidget *view);
    gint                gnome_mdi_add_child                 (GnomeMDI *mdi,
                                                             GnomeMDIChild *child);
    gint                gnome_mdi_remove_child              (GnomeMDI *mdi,
                                                             GnomeMDIChild *child,
                                                             gint force);
    gint                gnome_mdi_remove_all                (GnomeMDI *mdi,
                                                             gint force);
    void                gnome_mdi_open_toplevel             (GnomeMDI *mdi);
    void                gnome_mdi_update_child              (GnomeMDI *mdi,
                                                             GnomeMDIChild *child);
    GnomeMDIChild *     gnome_mdi_get_active_child          (GnomeMDI *mdi);
    GnomeMDIChild *     gnome_mdi_find_child                (GnomeMDI *mdi,
                                                             const gchar *name);
    GnomeApp *          gnome_mdi_get_active_window         (GnomeMDI *mdi);
    void                gnome_mdi_register                  (GnomeMDI *mdi,
                                                             GtkObject *object);
    void                gnome_mdi_unregister                (GnomeMDI *mdi,
                                                             GtkObject *object);
    GnomeApp *          gnome_mdi_get_app_from_view         (GtkWidget *view);
    GnomeMDIChild *     gnome_mdi_get_child_from_view       (GtkWidget *view);
    GtkWidget *         gnome_mdi_get_view_from_window      (GnomeMDI *mdi,
                                                             GnomeApp *app);
    GnomeUIInfo *       gnome_mdi_get_menubar_info          (GnomeApp *app);
    GnomeUIInfo *       gnome_mdi_get_toolbar_info          (GnomeApp *app);
    GnomeUIInfo *       gnome_mdi_get_child_menu_info       (GnomeApp *app);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GnomeMDI

## Signals

      "add-child"                                      : Run Last
      "add-view"                                       : Run Last
      "app-created"                                    : Run Last
      "child-changed"                                  : Run Last
      "remove-child"                                   : Run Last
      "remove-view"                                    : Run Last
      "view-changed"                                   : Run Last

## Description

## Details

### enum GnomeMDIMode

    typedef enum {
    	GNOME_MDI_NOTEBOOK,
    	GNOME_MDI_TOPLEVEL,
    	GNOME_MDI_MODAL,
    	GNOME_MDI_DEFAULT_MODE = 42
    } GnomeMDIMode;

### Warning

`GnomeMDIMode` is deprecated and should not be used in newly-written code.

### GnomeMDI

    typedef struct _GnomeMDI GnomeMDI;

### Warning

`GnomeMDI` is deprecated and should not be used in newly-written code.

### gnome_mdi_new ()

    GtkObject *         gnome_mdi_new                       (const gchar *appname,
                                                             const gchar *title);

### Warning

`gnome_mdi_new` is deprecated and should not be used in newly-written code.

Creates a new MDI object. `appname` and `title` are used for MDI's calling `gnome_app_new()`.

`appname` : | Application name as used in filenames and paths.
`title` : | Title of the application windows.
Returns : | A pointer to a new GnomeMDI object.

### gnome_mdi_set_mode ()

    void                gnome_mdi_set_mode                  (GnomeMDI *mdi,
                                                             GnomeMDIMode mode);

### Warning

`gnome_mdi_set_mode` is deprecated and should not be used in newly-written code.

Sets the MDI mode to mode. Possible values are `GNOME_MDI_TOPLEVEL`, `GNOME_MDI_NOTEBOOK`, `GNOME_MDI_MODAL` and `GNOME_MDI_DEFAULT`.

`mdi` : | A pointer to a GnomeMDI object.
`mode` : | New mode.

### gnome_mdi_set_menubar_template ()

    void                gnome_mdi_set_menubar_template      (GnomeMDI *mdi,
                                                             GnomeUIInfo *menu_tmpl);

### Warning

`gnome_mdi_set_menubar_template` is deprecated and should not be used in newly-written code.

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.

`mdi` : | A pointer to a GnomeMDI object.
`menu_tmpl` : | A GnomeUIInfo array describing the menu.

### gnome_mdi_set_toolbar_template ()

    void                gnome_mdi_set_toolbar_template      (GnomeMDI *mdi,
                                                             GnomeUIInfo *tbar_tmpl);

### Warning

`gnome_mdi_set_toolbar_template` is deprecated and should not be used in newly-written code.

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.

`mdi` : | A pointer to a GnomeMDI object.
`tbar_tmpl` : | A GnomeUIInfo array describing the toolbar.

### gnome_mdi_set_child_menu_path ()

    void                gnome_mdi_set_child_menu_path       (GnomeMDI *mdi,
                                                             const gchar *path);

### Warning

`gnome_mdi_set_child_menu_path` is deprecated and should not be used in newly-written code.

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.

### gnome_mdi_set_child_list_path ()

    void                gnome_mdi_set_child_list_path       (GnomeMDI *mdi,
                                                             const gchar *path);

### Warning

`gnome_mdi_set_child_list_path` is deprecated and should not be used in newly-written code.

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

### gnome_mdi_add_view ()

    gint                gnome_mdi_add_view                  (GnomeMDI *mdi,
                                                             GnomeMDIChild *child);

### Warning

`gnome_mdi_add_view` is deprecated and should not be used in newly-written code.

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.

### gnome_mdi_add_toplevel_view ()

    gint                gnome_mdi_add_toplevel_view         (GnomeMDI *mdi,
                                                             GnomeMDIChild *child);

### Warning

`gnome_mdi_add_toplevel_view` is deprecated and should not be used in newly-written code.

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.

### gnome_mdi_remove_view ()

    gint                gnome_mdi_remove_view               (GnomeMDI *mdi,
                                                             GtkWidget *view,
                                                             gint force);

### Warning

`gnome_mdi_remove_view` is deprecated and should not be used in newly-written code.

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`.

`mdi` : | A pointer to a GnomeMDI object.
`view` : | View to remove.
`force` : | If TRUE, the "remove_view" signal is not emitted.
Returns : | `TRUE` if the view was removed and `FALSE` otherwise.

### gnome_mdi_get_active_view ()

    GtkWidget *         gnome_mdi_get_active_view           (GnomeMDI *mdi);

### Warning

`gnome_mdi_get_active_view` is deprecated and should not be used in newly-written code.

Returns a pointer to the active view (the one with the focus).

`mdi` : | A pointer to a GnomeMDI object.
Returns : | A pointer to a GtkWidget *.

### gnome_mdi_set_active_view ()

    void                gnome_mdi_set_active_view           (GnomeMDI *mdi,
                                                             GtkWidget *view);

### Warning

`gnome_mdi_set_active_view` is deprecated and should not be used in newly-written code.

Sets the active view to `view`. It also raises the window containing it and gives it focus.

`mdi` : | A pointer to an MDI object.
`view` : | A pointer to the view that is to become the active one.

### gnome_mdi_add_child ()

    gint                gnome_mdi_add_child                 (GnomeMDI *mdi,
                                                             GnomeMDIChild *child);

### Warning

`gnome_mdi_add_child` is deprecated and should not be used in newly-written code.

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.

### gnome_mdi_remove_child ()

    gint                gnome_mdi_remove_child              (GnomeMDI *mdi,
                                                             GnomeMDIChild *child,
                                                             gint force);

### Warning

`gnome_mdi_remove_child` is deprecated and should not be used in newly-written code.

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.

### gnome_mdi_remove_all ()

    gint                gnome_mdi_remove_all                (GnomeMDI *mdi,
                                                             gint force);

### Warning

`gnome_mdi_remove_all` is deprecated and should not be used in newly-written code.

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.

### gnome_mdi_open_toplevel ()

    void                gnome_mdi_open_toplevel             (GnomeMDI *mdi);

### Warning

`gnome_mdi_open_toplevel` is deprecated and should not be used in newly-written code.

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).

`mdi` : | A pointer to a GnomeMDI object.

### gnome_mdi_update_child ()

    void                gnome_mdi_update_child              (GnomeMDI *mdi,
                                                             GnomeMDIChild *child);

### Warning

`gnome_mdi_update_child` is deprecated and should not be used in newly-written code.

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.

`mdi` : | A pointer to a GnomeMDI object.
`child` : | Child to update.

### gnome_mdi_get_active_child ()

    GnomeMDIChild *     gnome_mdi_get_active_child          (GnomeMDI *mdi);

### Warning

`gnome_mdi_get_active_child` is deprecated and should not be used in newly-written code.

Returns a pointer to the active GnomeMDIChild object.

`mdi` : | A pointer to a GnomeMDI object.
Returns : | A pointer to the active GnomeMDIChild object. `NULL`, if there is none.

### gnome_mdi_find_child ()

    GnomeMDIChild *     gnome_mdi_find_child                (GnomeMDI *mdi,
                                                             const gchar *name);

### Warning

`gnome_mdi_find_child` is deprecated and should not be used in newly-written code.

Finds a child named `name`.

`mdi` : | A pointer to a GnomeMDI object.
`name` : | A string with a name of the child to find.
Returns : | A pointer to the GnomeMDIChild object if the child was found and NULL otherwise.

### gnome_mdi_get_active_window ()

    GnomeApp *          gnome_mdi_get_active_window         (GnomeMDI *mdi);

### Warning

`gnome_mdi_get_active_window` is deprecated and should not be used in newly-written code.

Returns a pointer to the toplevel window containing the active view.

`mdi` : | A pointer to a GnomeMDI object.
Returns : | A pointer to a GnomeApp that has the focus.

### gnome_mdi_register ()

    void                gnome_mdi_register                  (GnomeMDI *mdi,
                                                             GtkObject *object);

### Warning

`gnome_mdi_register` is deprecated and should not be used in newly-written code.

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.

`mdi` : | A pointer to a GnomeMDI object.
`object` : | Object to register.

### gnome_mdi_unregister ()

    void                gnome_mdi_unregister                (GnomeMDI *mdi,
                                                             GtkObject *object);

### Warning

`gnome_mdi_unregister` is deprecated and should not be used in newly-written code.

Removes GtkObject `object` from the list of registered objects.

`mdi` : | A pointer to a GnomeMDI object.
`object` : | Object to unregister.

### gnome_mdi_get_app_from_view ()

    GnomeApp *          gnome_mdi_get_app_from_view         (GtkWidget *view);

### Warning

`gnome_mdi_get_app_from_view` is deprecated and should not be used in newly-written code.

Returns the toplevel window for this view.

`view` : | A pointer to a GtkWidget.
Returns : | A pointer to the GnomeApp containg the specified view.

### gnome_mdi_get_child_from_view ()

    GnomeMDIChild *     gnome_mdi_get_child_from_view       (GtkWidget *view);

### Warning

`gnome_mdi_get_child_from_view` is deprecated and should not be used in newly-written code.

Returns a child that `view` is a view of.

`view` : | A pointer to a GtkWidget.
Returns : | A pointer to the GnomeMDIChild the view belongs to.

### gnome_mdi_get_view_from_window ()

    GtkWidget *         gnome_mdi_get_view_from_window      (GnomeMDI *mdi,
                                                             GnomeApp *app);

### Warning

`gnome_mdi_get_view_from_window` is deprecated and should not be used in newly-written code.

Returns the pointer to the view in the MDI toplevel window `app`. If the mode is set to `GNOME_MDI_NOTEBOOK`, the view in the current page is returned.

`mdi` : | A pointer to a GnomeMDI object.
`app` : | A pointer to a GnomeApp widget.
Returns : | A pointer to a view.

### gnome_mdi_get_menubar_info ()

    GnomeUIInfo *       gnome_mdi_get_menubar_info          (GnomeApp *app);

### Warning

`gnome_mdi_get_menubar_info` is deprecated and should not be used in newly-written code.

`app` : | A pointer to a GnomeApp widget created by the MDI.
Returns : | A GnomeUIInfo array used for menubar in `app` if the menubar has been created with a template. `NULL` otherwise.

### gnome_mdi_get_toolbar_info ()

    GnomeUIInfo *       gnome_mdi_get_toolbar_info          (GnomeApp *app);

### Warning

`gnome_mdi_get_toolbar_info` is deprecated and should not be used in newly-written code.

`app` : | A pointer to a GnomeApp widget created by the MDI.
Returns : | A GnomeUIInfo array used for toolbar in `app` if the toolbar has been created with a template. `NULL` otherwise.

### gnome_mdi_get_child_menu_info ()

    GnomeUIInfo *       gnome_mdi_get_child_menu_info       (GnomeApp *app);

### Warning

`gnome_mdi_get_child_menu_info` is deprecated and should not be used in newly-written code.

`app` : | A pointer to a GnomeApp widget created by the MDI.
Returns : | A GnomeUIInfo array used for child's menus in `app` if they have been created with a template. `NULL` otherwise.

## Signal Details

### The `"add-child"` signal

    gboolean            user_function                      (GnomeMDI      *mdi,
                                                            GnomeMDIChild *arg1,
                                                            gpointer       user_data)      : Run Last

`mdi` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.
Returns : |

### The `"add-view"` signal

    gboolean            user_function                      (GnomeMDI  *mdi,
                                                            GtkWidget *widget,
                                                            gpointer   user_data)      : Run Last

`mdi` : | the object which received the signal.
`widget` : |
`user_data` : | user data set when the signal handler was connected.
Returns : |

### The `"app-created"` signal

    void                user_function                      (GnomeMDI *mdi,
                                                            GnomeApp *arg1,
                                                            gpointer  user_data)      : Run Last

`mdi` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The `"child-changed"` signal

    void                user_function                      (GnomeMDI      *mdi,
                                                            GnomeMDIChild *arg1,
                                                            gpointer       user_data)      : Run Last

`mdi` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The `"remove-child"` signal

    gboolean            user_function                      (GnomeMDI      *mdi,
                                                            GnomeMDIChild *arg1,
                                                            gpointer       user_data)      : Run Last

`mdi` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.
Returns : |

### The `"remove-view"` signal

    gboolean            user_function                      (GnomeMDI  *mdi,
                                                            GtkWidget *widget,
                                                            gpointer   user_data)      : Run Last

`mdi` : | the object which received the signal.
`widget` : |
`user_data` : | user data set when the signal handler was connected.
Returns : |

### The `"view-changed"` signal

    void                user_function                      (GnomeMDI  *mdi,
                                                            GtkWidget *widget,
                                                            gpointer   user_data)      : Run Last

`mdi` : | the object which received the signal.
`widget` : |
`user_data` : | user data set when the signal handler was connected.