Gnome User Interface Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# GnomeMDIChild

## Name

GnomeMDIChild -- An abstract MDI child class

## Synopsis

    #include <gnome.h>

    struct      GnomeMDIChild;
    GtkWidget*  (*GnomeMDIChildViewCreator)     (GnomeMDIChild*,
                                                 gpointer);
    GList*      (*GnomeMDIChildMenuCreator)     (GnomeMDIChild*,
                                                 GtkWidget*,
                                                 gpointer);
    gchar*      (*GnomeMDIChildConfigFunc)      (GnomeMDIChild*,
                                                 gpointer);
    GtkWidget*  (*GnomeMDIChildLabelFunc)       (GnomeMDIChild*,
                                                 GtkWidget*,
                                                 gpointer);
    GtkWidget*  gnome_mdi_child_add_view        (GnomeMDIChild *mdi_child);
    void        gnome_mdi_child_remove_view     (GnomeMDIChild *mdi_child,
                                                 GtkWidget *view);
    void        gnome_mdi_child_set_name        (GnomeMDIChild *mdi_child,
                                                 gchar *name);
    void        gnome_mdi_child_set_menu_template
                                                (GnomeMDIChild *mdi_child,
                                                 GnomeUIInfo *menu_tmpl);

## Object Hierarchy

      GtkObject
       +----GnomeMDIChild

## Description

GnomeMDIChild is an abstract class for GnomeMDI children. In order to use it, you have to either derive a new class from it and define the proper virtual functions in its parent GnomeMDIChildClass structure or use the GnomeMDIGenericChild class that allows to specify the relevant functions on a per-instance rather than on per-class basis.

Each instance of GnomeMDIChild class defines a name for the child and possibly a menu template for document-specific menus that will be merged with the global MDI menus. The menu template is set using the gnome_mdi_child_set_menu_template() function.

The GnomeMDIChild class has four virtual functions that are used by the MDI:

- create_view must be defined for each subclass and must return a pointer to a GtkWidget representing a new view of the document.

- create_menus must return a GList of menu items and can be used instead of the child's menu template. If both template and this function are defined, only the template (which can be defined on a per-instance basis) is used.

- get_config_string must return a string that represents the state of the child and will be used to save and restore state of the MDI children bewtween sessions.

- set_label must return a pointer to a GtkWidget that will be used as notebook and menu item label for this child.

create_view function must be defined for each subclass and the GnomeMDIChild class provides a simple default implementation of set_label; create_menus and get_config_string may be undefined.

## Details

### struct GnomeMDIChild

    struct GnomeMDIChild;

### GnomeMDIChildViewCreator ()

    GtkWidget*  (*GnomeMDIChildViewCreator)     (GnomeMDIChild*,
                                                 gpointer);

`Param1` : |
`Param2` : |
Returns : |

### GnomeMDIChildMenuCreator ()

    GList*      (*GnomeMDIChildMenuCreator)     (GnomeMDIChild*,
                                                 GtkWidget*,
                                                 gpointer);

`Param1` : |
`Param2` : |
`Param3` : |
Returns : |

### GnomeMDIChildConfigFunc ()

    gchar*      (*GnomeMDIChildConfigFunc)      (GnomeMDIChild*,
                                                 gpointer);

`Param1` : |
`Param2` : |
Returns : |

### GnomeMDIChildLabelFunc ()

    GtkWidget*  (*GnomeMDIChildLabelFunc)       (GnomeMDIChild*,
                                                 GtkWidget*,
                                                 gpointer);

`Param1` : |
`Param2` : |
`Param3` : |
Returns : |

### gnome_mdi_child_add_view ()

    GtkWidget*  gnome_mdi_child_add_view        (GnomeMDIChild *mdi_child);

Creates a new view of a child (a GtkWidget) adds it to the list of the views and returns a pointer to it. Virtual function that has to be specified for classes derived from GnomeMDIChild is used to create the new view.

`mdi_child` : | A pointer to a GnomeMDIChild object.
Returns : | A pointer to the new view.

### gnome_mdi_child_remove_view ()

    void        gnome_mdi_child_remove_view     (GnomeMDIChild *mdi_child,
                                                 GtkWidget *view);

Removes view `view` from the list of `mdi_child`'s views and unrefs it.

`mdi_child` : | A pointer to a GnomeMDIChild object.
`view` : | View to be removed.

### gnome_mdi_child_set_name ()

    void        gnome_mdi_child_set_name        (GnomeMDIChild *mdi_child,
                                                 gchar *name);

Changes name of `mdi_child` to `name`. `name` is duplicated and stored in `mdi_child`. If `mdi_child` has already been added to GnomeMDI, it also takes care of updating it.

`mdi_child` : | A pointer to a GnomeMDIChild object.
`name` : | String containing the new name for the child.

### gnome_mdi_child_set_menu_template ()

    void        gnome_mdi_child_set_menu_template
                                                (GnomeMDIChild *mdi_child,
                                                 GnomeUIInfo *menu_tmpl);

Sets the template for menus that are added and removed when differrent children get activated. This way, each child can modify the MDI menubar to suit its needs. If no template is set, the create_menus virtual function will be used for creating these menus (it has to return a GList of menu items). If no such function is specified, the menubar will be unchanged by MDI children.

`mdi_child` : | A pointer to a GnomeMDIChild object.
`menu_tmpl` : | A GnomeUIInfo array describing the child specific menus.

<<< Previous Page | Home | Up | Next Page >>>
GnomeLess | GnomeMDIGenericChild