![]() | ![]() | Gwyddion Application Library Reference Manual | ![]() |
---|
menu — Menu and sensitivity functions.
enum GwyMenuSensFlags; struct GwyMenuSensData; void gwy_app_menu_set_sensitive_recursive (GtkWidget *widget, GwyMenuSensData *data); void gwy_app_menu_recent_files_update (GList *recent_files); void gwy_app_menu_set_flags_recursive (GtkWidget *widget, GwyMenuSensData *data); void gwy_app_menu_set_sensitive_array (GtkItemFactory *item_factory, const gchar *root, const gchar **items, GwyMenuSensFlags flags); void gwy_app_menu_set_sensitive_both (GtkWidget *item, GwyMenuSensFlags flags, GwyMenuSensFlags state); void gwy_app_toolbox_update_state (GwyMenuSensData *sens_data);
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.
A widget can have defined a set of conditions (by gwy_app_menu_set_sensitive_both() and other fucntions) that have all to be satisfied to become sensitive. If there are no conditions defined, the widget is sensitive always.
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_MASK = 0xff } GwyMenuSensFlags;
Menu sensitivity flags.
They represent various application states that may be preconditions for some menu item (or other widget) to become sensitive.
GWY_MENU_FLAG_DATA | There's at least a one data window present. |
GWY_MENU_FLAG_UNDO | There's something to undo (for current data window). |
GWY_MENU_FLAG_REDO | There's something to redo (for current data window). |
GWY_MENU_FLAG_GRAPH | There's 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_MASK | All the bits combined. |
struct GwyMenuSensData { GwyMenuSensFlags flags; GwyMenuSensFlags set_to; };
Sensitivity flags and their current state in one struct.
All widget bits have to be set to make it sensitive.
GwyMenuSensFlags flags | The flags that have to be set for a widget to become sensitive. |
GwyMenuSensFlags set_to | The actually set flags. |
void gwy_app_menu_set_sensitive_recursive (GtkWidget *widget, GwyMenuSensData *data);
Sets sensitivity bits and current state of a menu subtree at widget according data.
widget : | A menu widget (a menu bar, menu, or an item). |
data : | Sensitivity data. |
void gwy_app_menu_recent_files_update (GList *recent_files);
recent_files : |
void gwy_app_menu_set_flags_recursive (GtkWidget *widget, GwyMenuSensData *data);
widget : | |
data : |
void gwy_app_menu_set_sensitive_array (GtkItemFactory *item_factory, const gchar *root, const gchar **items, GwyMenuSensFlags flags);
Sets sensitivity flags for a list of menu items.
item_factory : | A item factory to obtain menu items from. |
root : | Menu root, without "<" and ">". |
items : | NULL-terminated array of item paths in the menu (without the root). |
flags : | Sensitivity bits describing when the item should be sensitive. |
void gwy_app_menu_set_sensitive_both (GtkWidget *item, GwyMenuSensFlags flags, GwyMenuSensFlags state);
Sets both senstitivity data and current state for a menu item.
item : | A menu item. |
flags : | Sensitivity bits describing when the item should be sensitive. |
state : | Current state bits determining whether it's actually sensitive or not. |
void gwy_app_toolbox_update_state (GwyMenuSensData *sens_data);
Updates menus and toolbox sensititivity to reflect sens_data.
sens_data : | Menu sensitivity data. |
<< settings | menu-windowlist >> |