menu — Menu and sensitivity functions
#include <app/gwyapp.h> enum GwyMenuSensFlags; GtkWidget* gwy_app_build_process_menu (GtkAccelGroup *accel_group); void gwy_app_process_menu_add_run_last (GtkWidget *menu); GwyRunType gwy_app_run_process_func (const gchar *name); void gwy_app_run_process_func_in_mode (const gchar *name, GwyRunType run); GtkWidget* gwy_app_build_graph_menu (GtkAccelGroup *accel_group); void gwy_app_run_graph_func (const gchar *name); void gwy_app_menu_recent_files_update (GList *recent_files); GtkWidget* gwy_app_menu_recent_files_get (void); GtkTooltips* gwy_app_get_tooltips (void); GwySensitivityGroup* gwy_app_sensitivity_get_group (void); void gwy_app_sensitivity_add_widget (GtkWidget *widget, GwyMenuSensFlags mask); void gwy_app_sensitivity_set_state (GwyMenuSensFlags affected_mask, GwyMenuSensFlags state);
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.
typedef enum {
GWY_MENU_FLAG_DATA = 1 << 0,
GWY_MENU_FLAG_UNDO = 1 << 1,
GWY_MENU_FLAG_REDO = 1 << 2,
GWY_MENU_FLAG_GRAPH = 1 << 3,
GWY_MENU_FLAG_LAST_PROC = 1 << 4,
GWY_MENU_FLAG_LAST_GRAPH = 1 << 5,
GWY_MENU_FLAG_DATA_MASK = 1 << 6,
GWY_MENU_FLAG_DATA_SHOW = 1 << 7,
GWY_MENU_FLAG_3D = 1 << 8,
GWY_MENU_FLAG_FILE = 1 << 9,
GWY_MENU_FLAG_MASK = 0x1ff
} GwyMenuSensFlags;
Global application sensitivity flags.
They represent various application states that may be preconditions for widgets to become sensitive.
| There's at least a one data window present. | |
| There's something to undo (for current data window). | |
| There's something to redo (for current data window). | |
| There's at least a one graph window present. | |
| There is a last-run data processing function to rerun. | |
| There is a last-run graph function to rerun. | |
| There is a mask on the data. | |
| There is a presentation on the data. | |
| A 3D view is present. | |
| A file is open, with any type of data (Since: 2.5). | |
| All the bits combined. |
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 registeration has to be performed first for this function to make sense.
|
Acceleration group to be associated with the menu. |
Returns : |
A newly ceated data processing menu (a GtkMenu). |
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.
|
Menu created with gwy_app_build_process_menu().
|
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.
|
A data processing function name. |
Returns : |
The actually used mode (nonzero), or 0 on failure. |
void gwy_app_run_process_func_in_mode (const gchar *name, GwyRunType run);
Runs a data processing function on current data in specified mode.
|
A data processing function name. |
|
A run mode. |
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 registeration has to be performed first for this function to make sense.
|
Acceleration group to be associated with the menu. |
Returns : |
A newly ceated graph menu (a GtkMenu). |
void gwy_app_run_graph_func (const gchar *name);
Runs a graph function on the current graph.
|
A graph function name. |
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.
|
A list of recent file names, in UTF-8. |
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). |
GtkTooltips* gwy_app_get_tooltips (void);
Gets the application-wide tooltips instance.
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. |
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. |
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).
|
Widget to add. |
|
Which flags the widget is sensitive to. |
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).
|
Which bits in state to copy to state.
|
|
The new state (masked with affected_mask).
|