Description

This is the GnomeMDI interface from Jaka Mocnik used in GHex and GTop.

gnome_mdi_new - create a new GnomeMDI object

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

Description

This function returns a new GnomeMDI object. It is normally only called once in main. Mode is set to the default mode (selected by the user in look-and-feel properties).

Usage

	GnomeMDI *mdi = gnome_mdi_new ("gtop", "GTop");
      

Parameters

  • gchar *appname

    An application name string. This string is duplicated and stored within the GnomeMDI structure. The stored copy is passed as the first parameter of gnome_app_new when the MDI creates a new toplevel window.

  • gchar *title

    The title of the application. This string is duplicated and stored within the GnomeMDI structure. The stored copy is passed as the second parameter of gnome_app_new when the MDI creates a new toplevel window and used in constructing the toplevel window title.

gnome_mdi_set_mode - set GnomeMDI mode

void gnome_mdi_set_mode(GnomeMDI *mdi, GnomeMDIMode mode);

Description

This function sets the MDI mode to mode. When called without any views open, it simply opens a new toplevel window, otherwise it hides all views and re-shows them in the new mode.

Usage

	gnome_mdi_set_mode (mdi, GNOME_MDI_NOTEBOOK);
      

Parameters

  • GnomeMDI *mdi

    A pointer to a GnomeMDI object.

  • GnomeMDIMode mode

    The mode to switch MDI to; can be one of the following:

    GNOME_MDI_NOTEBOOK

    Where each view is displayed as a notebook page, giving the user ability to distribute these between multiple notebooks (by dragging the pages onto the root window or into another notebook of the same application), each in its own toplevel window.

    GNOME_MDI_TOPLEVEL

    In this mode, each view is displayed in its own toplevel window.

    GNOME_MDI_MODAL

    in the "modal" mode, only one view is displayed at a time. Other children can be selected from a menu.

    GNOME_MDI_DEFAULT_MODE

    The mode is set to the one that was chosen by the user running the application in look-and-feel properties. This is the preferred choice for most applications.

gnome_mdi_set_tab_pos - set the position of the MDI notebook tabs

void gnome_mdi_set_tab_pos(GnomeMDI *mdi, GtkPositionTypetab_pos);

Description

Set the position of the tabs of the notebook shown in GNOME_MDI_NOTEBOOK mode to tab_pos.

Usage

	gnome_mdi_set_tab_pos (mdi, GTK_POS_LEFT);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GtkPositionType tab_pos

    The new position of the notebook tabs for MDI notebooks in GNOME_MDI_NOTEBOOK mode. See gtk_notebook_set_tab_pos for more details on possible tab positions.

gnome_mdi_set_menu_template - set the template for MDI menus

void gnome_mdi_set_menu_template(GnomeMDI *mdi, GnomeUIInfo *menu_template);

Description

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) as data with key GNOME_MDI_MENUBAR_INFO_KEY.

The copy of the template (and, most importantly, its widget members) can be accessed through the corresponding GnomeApp widget with the gtk_object_get_data() call:

          GnomeUIInfo *uiinfo;

          uiinfo = gtk_object_get_data(GTK_OBJECT(mdi->active_window), GNOME_MDI_MENUBAR_INFO_KEY);
          gtk_widget_set_sensitive(uiinfo[3].member, FALSE);
        

Usage

	gnome_mdi_set_menu_template(mdi, mdi_menubar);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GnomeUIInfo *menu_template

    A pointer to an array of GnomeUIInfo entries. These should remain unchanged during the life-cycle of the MDI object, since they are copied each time a new toplevel window is created.

gnome_mdi_set_toolbar_template - set the template for MDI toolbar

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

Description

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) as data with key GNOME_MDI_TOOLBAR_INFO_KEY.

The copy of the template (and, most importantly, its widget members) can be accessed through the corresponding GnomeApp widget with the gtk_object_get_data() call:

          GnomeUIInfo *uiinfo;

          uiinfo = gtk_object_get_data(GTK_OBJECT(mdi->active_window), GNOME_MDI_TOOLBAR_INFO_KEY);
          gtk_widget_set_sensitive(uiinfo[3].member, FALSE);
        

Usage

	gnome_mdi_set_toolbar_template(mdi, mdi_toolbar);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GnomeUIInfo *toolbar_template

    A pointer to an array of GnomeUIInfo entries. These should remain unchanged during the life-cycle of the MDI object, since they are copied each time a new toplevel window is created.

gnome_mdi_set_child_menu_path - sets the path for child-specific menus

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

Description

Sets the desired position of child-specific menus (which are re-added to each toplevel window when a new view is activated in it). See gnome_app_find_menu_pos for details on menu paths.

Usage

	gnome_mdi_set_child_menu_path(mdi, "File");
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • gchar *path

    A menu path (see gnome_app_find_menu_pos for details on menu paths) describing the position where the child menus should be inserted.

gnome_mdi_set_child_list_path - sets the menu path for the list of children

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

Description

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

Usage

	gnome_mdi_set_child_list_path(mdi, "Children/");
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • gchar *path

    A menu path (see gnome_app_find_menu_pos for details on menu paths) describing the position where the menu items with names of children will be inserted.

gnome_mdi_add_view - adds a new view to the MDI

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

Description

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.

The function returns TRUE if the view has been added and FALSE otherwise.

Usage

	success = gnome_mdi_add_view(mdi, child);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GnomeMDIChild *child

    The child, a view of which is to be added to the MDI.

gnome_mdi_add_toplevel_view - adds a new view to the MDI in a new toplevel window

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

Description

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 opens in GNOME_MDI_NOTEBOOK mode, the view is added in a new toplevel window unless the active one has no views in it.

The function returns TRUE if the view has been successfully added and FALSE otherwise.

Usage

	success = gnome_mdi_add_toplevel_view(mdi, child);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GnomeMDIChild *child

    The child, a view of which is to be added to the MDI.

gnome_mdi_remove_view - removes an existing view from the MDI

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

Description

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.

The function returns TRUE if the view has been removed and FALSE otherwise.

Usage

	success = gnome_mdi_remove_view(mdi, view, FALSE);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GtkWidget *view

    The view to remove.

  • gint force

    If TRUE, the "remove_view" signal is not emmited before removing the view, meaning that the view is unconditionally removed.

gnome_mdi_active_view - returns a pointer to the last active view

GtkWidget *gnome_mdi_active_view(GnomeMDI *mdi);

Description

Returns a pointer to the last active view (ie: the view that has last had the focus) or NULL if there is none.

Usage

	active_view = gnome_mdi_active_view(mdi);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

gnome_mdi_set_active_view - sets the active view

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

Description

Sets the active view to view.

Usage

	gnome_mdi_set_active_view(mdi, view);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GtkWidget *view

    The active-to-be view, already added to the MDI.

gnome_mdi_add_child - adds a new child to an MDI

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

Description

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.

The function returns TRUE if the child has been added and FALSE otherwise.

Usage

	success = gnome_mdi_add_child(mdi, child);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GnomeMDIChild *child

    The child to add to the MDI.

gnome_mdi_remove_child - removes a child from the MDI

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

Description

Removes a child and all of its views from the MDI.

A "remove_child" signal is emitted to the MDI 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.

The function returns TRUE if the child has been removed and FALSE otherwise.

Usage

	success = gnome_mdi_remove_child(mdi, child, FALSE);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GnomeMDIChild *child

    The child to remove.

  • gint force

    If TRUE, the "remove_child" signal is not emmited before removing the child. Thus the child is unconditionally removed.

gnome_mdi_remove_all - removes all children from the MDI

gint gnome_mdi_remove_all(GnomeMDI *mdi, gint force);

Description

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.

The function returns TRUE if all children have been removed and FALSE otherwise.

Usage

	success = gnome_mdi_remove_all(mdi, FALSE);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • gint force

    If TRUE, the "remove_child" signals are not emmited before removing children. All children are unconditionally removed in this case.

gnome_mdi_update_child - updates a child when its name changes

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

Description

For the time being all it does is update the child's name in the MDI.

Usage

	gnome_mdi_update_child(mdi, child);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GnomeMDIChild *child

    The child to update.

gnome_mdi_active_child - returns the active child

GnomeMDIChild *gnome_mdi_active_child(GnomeMDI *mdi);

Description

Returns the last active child (ie: the child a view of which has last had focus).

Usage

	active_child = gnome_mdi_active_child(mdi);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

gnome_mdi_find_child - returns a named child

GnomeMDIChild *gnome_mdi_update_child(GnomeMDI *mdi, gchar *name);

Description

Returns the child named name. If no child with such name is found, NULL is returned.

Usage

	wanted_child = gnome_mdi_find_child(mdi, "Donald E.");
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • gchar *name

    A string with the name of the child we are looking for.

gnome_mdi_open_toplevel - opens a new toplevel window

void gnome_mdi_open_toplevel(GnomeMDI *mdi);

Description

Unless the MDI is in GNOME_MDI_MODAL mode, a new toplevel window is created. In GNOME_MDI_MODAL mode the number of toplevel windows is constrained to a maximum of one.

Usage

	gnome_mdi_open_toplevel(mdi);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

gnome_mdi_register - registers a GtkObject with MDI

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

Description

Registers a GtkObject 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.

Usage

	gnome_mdi_register(mdi, tool_window);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GtkObject *object

    A pointer to the object to register.

gnome_mdi_unregister - removes a GtkObject from the list of registered objects

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

Description

Removes a GtkObject from the list of registered objects.

Usage

	gnome_mdi_unregister(mdi, tool_window);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GtkObject *object

    A pointer to the object to remove from the list of registered objects.

gnome_mdi_get_app_from_view - retrieves a view's toplevel window

GnomeApp *gnome_mdi_get_app_from_view(GtkWidget *view);

Description

Returns a view's toplevel window.

Usage

	view_app = gnome_mdi_get_app_from_view(view);
      

Parameters

  • GtkWidget *view

    A pointer to a view that has been added to MDI.

gnome_mdi_get_child_from_view - retrieves a view's child

GnomeMDIChild *gnome_mdi_get_child_from_view(GtkWidget *view);

Description

Returns the child that view belongs to.

Usage

	view_child = gnome_mdi_get_child_from_view(view);
      

Parameters

  • GtkWidget *view

    A pointer to a view that has been added to MDI.

gnome_mdi_get_view_from_window - retrieves a view from a certain window

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

Description

Returns the view that resides in window app. If MDI mode is GNOME_MDI_NOTEBOOK, the view in the selected notebook page is returned.

Usage

	view = gnome_mdi_get_view_from_window(mdi, app);
      

Parameters

  • GnomeMDI *mdi

    A pointer to an MDI object.

  • GnomeApp *app

    A pointer to a GnomeApp widget created by the MDI mdi