menu: Gwyddion Application Library Reference Manual

## menu menu — Menu and sensitivity functions |

## Functions

GtkWidget * | gwy_app_build_process_menu ()
void | gwy_app_process_menu_add_run_last ()
GwyRunType | gwy_app_run_process_func ()
void | gwy_app_run_process_func_in_mode ()
GtkWidget * | gwy_app_build_graph_menu ()
void | gwy_app_run_graph_func ()
GtkWidget * | gwy_app_build_volume_menu ()
GwyRunType | gwy_app_run_volume_func ()
void | gwy_app_run_volume_func_in_mode ()
GtkWidget * | gwy_app_build_xyz_menu ()
GwyRunType | gwy_app_run_xyz_func ()
void | gwy_app_run_xyz_func_in_mode ()
GtkWidget * | gwy_app_build_curve_map_menu ()
GwyRunType | gwy_app_run_curve_map_func ()
void | gwy_app_run_curve_map_func_in_mode ()
void | gwy_app_menu_recent_files_update ()
GtkWidget * | gwy_app_menu_recent_files_get ()
GtkTooltips * | gwy_app_get_tooltips ()
GwySensitivityGroup * | gwy_app_sensitivity_get_group ()
void | gwy_app_sensitivity_add_widget ()
void | gwy_app_sensitivity_set_state ()

## Types and Values

enum | GwyMenuSensFlags

## Includes

    #include <app/gwyapp.h>

## Description

Menu and toolbox item sensitivity is updated by main application whenever its state changes. Possible states that may affect widget sesitivity are defined in GwyMenuSensFlags.

## Functions

### gwy_app_build_process_menu ()

    GtkWidget *
    gwy_app_build_process_menu (GtkAccelGroup *accel_group);

Constructs the application Data Process menu.

The menu is created from data processing functions registered by modules, therefore module registration has to be done first for this function to make sense.

#### Parameters

accel_group | Acceleration group to be associated with the menu. |

#### Returns

A newly ceated data processing menu (a GtkMenu).

### gwy_app_process_menu_add_run_last ()

    void
    gwy_app_process_menu_add_run_last (GtkWidget *menu);

Adds Re-show Last and Repeat Last items to application data process menu.

This function is essentially useful only for toolbox construction.

#### Parameters

menu | Menu created with `gwy_app_build_process_menu()`. |

### gwy_app_run_process_func ()

    GwyRunType
    gwy_app_run_process_func (const gchar *name);

Runs a data processing function on the current data.

From the run modes function `name` supports, the most interactive one is selected.

#### Parameters

name | A data processing function name. |

#### Returns

The actually used mode (nonzero), or 0 on failure.

### gwy_app_run_process_func_in_mode ()

    void
    gwy_app_run_process_func_in_mode (const gchar *name,
                                      GwyRunType run);

Runs a data processing function on current data in specified mode.

#### Parameters

name | A data processing function name. |
run | A run mode. |

### gwy_app_build_graph_menu ()

    GtkWidget *
    gwy_app_build_graph_menu (GtkAccelGroup *accel_group);

Constructs the application Graph menu.

The menu is created from graph functions registered by modules, therefore module registration has to be done first for this function to make sense.

#### Parameters

accel_group | Acceleration group to be associated with the menu. |

#### Returns

A newly ceated graph menu (a GtkMenu).

### gwy_app_run_graph_func ()

    void
    gwy_app_run_graph_func (const gchar *name);

Runs a graph function on the current graph.

#### Parameters

name | A graph function name. |

### gwy_app_build_volume_menu ()

    GtkWidget *
    gwy_app_build_volume_menu (GtkAccelGroup *accel_group);

Constructs the application Volume Data menu.

The menu is created from volume data processing functions registered by modules, therefore module registration has to be done first for this function to make sense.

#### Parameters

accel_group | Acceleration group to be associated with the menu. |

#### Returns

A newly ceated volume data processing menu (a GtkMenu).

Since: 2.32

### gwy_app_run_volume_func ()

    GwyRunType
    gwy_app_run_volume_func (const gchar *name);

Runs a volume data processing function on the current data.

From the run modes function `name` supports, the most interactive one is selected.

#### Parameters

name | A volume data processing function name. |

#### Returns

The actually used mode (nonzero), or 0 on failure.

Since: 2.32

### gwy_app_run_volume_func_in_mode ()

    void
    gwy_app_run_volume_func_in_mode (const gchar *name,
                                     GwyRunType run);

Runs a volume data processing function on current data in specified mode.

#### Parameters

name | A volume data processing function name. |
run | A run mode. |

Since: 2.32

### gwy_app_build_xyz_menu ()

    GtkWidget *
    gwy_app_build_xyz_menu (GtkAccelGroup *accel_group);

Constructs the application XYZ Data menu.

The menu is created from XYZ data processing functions registered by modules, therefore module registration has to be done first for this function to make sense.

#### Parameters

accel_group | Acceleration group to be associated with the menu. |

#### Returns

A newly ceated XYZ data processing menu (a GtkMenu).

Since: 2.45

### gwy_app_run_xyz_func ()

    GwyRunType
    gwy_app_run_xyz_func (const gchar *name);

Runs a XYZ data processing function on the current data.

From the run modes function `name` supports, the most interactive one is selected.

#### Parameters

name | A XYZ data processing function name. |

#### Returns

The actually used mode (nonzero), or 0 on failure.

Since: 2.45

### gwy_app_run_xyz_func_in_mode ()

    void
    gwy_app_run_xyz_func_in_mode (const gchar *name,
                                  GwyRunType run);

Runs a XYZ data processing function on current data in specified mode.

#### Parameters

name | A XYZ data processing function name. |
run | A run mode. |

Since: 2.45

### gwy_app_build_curve_map_menu ()

    GtkWidget *
    gwy_app_build_curve_map_menu (GtkAccelGroup *accel_group);

Constructs the application Curve Maps menu.

The menu is created from curve map data processing functions registered by modules, therefore module registration has to be done first for this function to make sense.

#### Parameters

accel_group | Acceleration group to be associated with the menu. |

#### Returns

A newly ceated curve map data processing menu (a GtkMenu).

Since: 2.60

### gwy_app_run_curve_map_func ()

    GwyRunType
    gwy_app_run_curve_map_func (const gchar *name);

Runs a curve map processing function on the current data.

From the run modes function `name` supports, the most interactive one is selected.

#### Parameters

name | A curve map processing function name. |

#### Returns

The actually used mode (nonzero), or 0 on failure.

Since: 2.45

### gwy_app_run_curve_map_func_in_mode ()

    void
    gwy_app_run_curve_map_func_in_mode (const gchar *name,
                                        GwyRunType run);

Runs a curve map processing function on current data in specified mode.

#### Parameters

name | A curve map processing function name. |
run | A run mode. |

Since: 2.45

### gwy_app_menu_recent_files_update ()

    void
    gwy_app_menu_recent_files_update (GList *recent_files);

Updates recent file menu.

If the list of files is longer than the maximum number of recent file menu items, only the maximum number is shown.

#### Parameters

recent_files | A list of recent file names, in UTF-8. |

### gwy_app_menu_recent_files_get ()

    GtkWidget *
    gwy_app_menu_recent_files_get (void);

Gets the application recent files menu.

The menu is initially empty and can be updated with `gwy_app_menu_recent_files_update()`. This function is essentially useful only for toolbox construction.

#### Returns

The recent files menu (a GtkMenu).

### gwy_app_get_tooltips ()

    GtkTooltips *
    gwy_app_get_tooltips (void);

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

Gets the application-wide tooltips instance.

Do not use. Use `gtk_widget_set_tooltip_text()` or `gtk_widget_set_tooltip_markup()` instead.

#### Returns

The global tooltips instance. No reference is added, you can add yours, but the returned object will exist to the end of program anyway.

### gwy_app_sensitivity_get_group ()

    GwySensitivityGroup *
    gwy_app_sensitivity_get_group (void);

Gets the application-wide widget sensitvity group.

The flags to be used with this sensitvity group are defined in GwyMenuSensFlags.

#### Returns

The global sensitvity group instead. No reference is added, you can add yours, but the returned object will exist to the end of program anyway.

### gwy_app_sensitivity_add_widget ()

    void
    gwy_app_sensitivity_add_widget (GtkWidget *widget,
                                    GwyMenuSensFlags mask);

Adds a widget to the application-wide widget sensitvity group.

The semantics of this function is the same as `gwy_sensitivity_group_add_widget()` (in fact, it's a simple wrapper around it).

#### Parameters

widget | Widget to add. |
mask | Which flags the widget is sensitive to. |

### gwy_app_sensitivity_set_state ()

    void
    gwy_app_sensitivity_set_state (GwyMenuSensFlags affected_mask,
                                   GwyMenuSensFlags state);

Sets the state of application-wide widget sensitvity group.

The semantics of this function is the same as `gwy_sensitivity_group_set_state()` (in fact, it's a simple wrapper around it).

#### Parameters

affected_mask | Which bits in `state` to copy to state. |
state | The new state (masked with `affected_mask` ). |

## Types and Values

### enum GwyMenuSensFlags

Global application sensitivity flags.

They represent various application states that may be preconditions for widgets to become sensitive.

#### Members

GWY_MENU_FLAG_DATA | There is at least a one data window present. |
GWY_MENU_FLAG_UNDO | There is something to undo (for current data window). |
GWY_MENU_FLAG_REDO | There is something to redo (for current data window). |
GWY_MENU_FLAG_GRAPH | There is at least a one graph window present. |
GWY_MENU_FLAG_LAST_PROC | There is a last-run data processing function to rerun. |
GWY_MENU_FLAG_LAST_GRAPH | There is a last-run graph function to rerun. |
GWY_MENU_FLAG_DATA_MASK | There is a mask on the data. |
GWY_MENU_FLAG_DATA_SHOW | There is a presentation on the data. |
GWY_MENU_FLAG_3D | A 3D view is present. |
GWY_MENU_FLAG_FILE | A file is open, with any type of data (Since 2.5). |
GWY_MENU_FLAG_VOLUME | There is at least one volume data window present (Since 2.32). |
GWY_MENU_FLAG_XYZ | There is at least one XYZ surface data window present (Since 2.45). |
GWY_MENU_FLAG_CURVE_MAP | There is at least one GwyLawn curve map window present (Since 2.60). |
GWY_MENU_FLAG_GRAPH_CURVE | There current graph window contains at least one curve (Since 2.60). This ensures a graph function will not be run on an empty graph. |
GWY_MENU_FLAG_MASK | All the bits combined. |