menu

menu — Menu and sensitivity functions.

Synopsis




enum        GwyMenuSensFlags;
            GwyMenuSensData;
void        gwy_app_menu_set_sensitive_recursive
                                            (GtkWidget *widget,
                                             const GwyMenuSensData *data);
void        gwy_app_menu_recent_files_update
                                            (GList *recent_files);
void        gwy_app_menu_set_flags_recursive
                                            (GtkWidget *widget,
                                             const GwyMenuSensData *data);
void        gwy_app_menu_set_sensitive_array
                                            (GtkItemFactory *item_factory,
                                             const gchar *root,
                                             const gchar **items,
                                             const GwyMenuSensFlags flags);
void        gwy_app_menu_set_sensitive_both (GtkWidget *item,
                                             GwyMenuSensFlags flags,
                                             GwyMenuSensFlags state);
void        gwy_app_toolbox_update_state    (const GwyMenuSensData *sens_data);
GtkTooltips* gwy_app_tooltips_get           (void);

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.

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.

Details

enum 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_GL_OK      = 1 << 8,
/*    GWY_MENU_FLAG_3D         = 1 << 9, */
    GWY_MENU_FLAG_MASK       = 0x1ff
} 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_GL_OK OpenGL is available.
GWY_MENU_FLAG_MASK All the bits combined.

GwyMenuSensData

typedef struct {
    GwyMenuSensFlags flags;
    GwyMenuSensFlags set_to;
} GwyMenuSensData;

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.

gwy_app_menu_set_sensitive_recursive ()

void        gwy_app_menu_set_sensitive_recursive
                                            (GtkWidget *widget,
                                             const 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.

gwy_app_menu_recent_files_update ()

void        gwy_app_menu_recent_files_update
                                            (GList *recent_files);

Updates recent file menu to show recent_files.

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

gwy_app_menu_set_flags_recursive ()

void        gwy_app_menu_set_flags_recursive
                                            (GtkWidget *widget,
                                             const GwyMenuSensData *data);

Adds item sensitivity data data to a menu subtree widget.

Adding means bitwise OR with existing flags, so existing flags are kept.

widget : A menu widget (a menu bar, menu, or an item).
data : Sensitivity data.

gwy_app_menu_set_sensitive_array ()

void        gwy_app_menu_set_sensitive_array
                                            (GtkItemFactory *item_factory,
                                             const gchar *root,
                                             const gchar **items,
                                             const 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.

gwy_app_menu_set_sensitive_both ()

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.

gwy_app_toolbox_update_state ()

void        gwy_app_toolbox_update_state    (const GwyMenuSensData *sens_data);

Updates menus and toolbox sensititivity to reflect sens_data.

sens_data : Menu sensitivity data.

gwy_app_tooltips_get ()

GtkTooltips* gwy_app_tooltips_get           (void);

Returns :