app

app — Core application interface, window management

Synopsis




enum        GwyAppWindowType;
GwyContainer* gwy_app_get_current_data      (void);
GwyDataWindow* gwy_app_data_window_get_current
                                            (void);
gboolean    gwy_app_data_window_set_current (GwyDataWindow *window);
void        gwy_app_data_window_remove      (GwyDataWindow *window);
void        gwy_app_data_window_foreach     (GFunc func,
                                             gpointer user_data);
gulong      gwy_app_data_window_list_add_hook
                                            (gpointer func,
                                             gpointer data);
gboolean    gwy_app_data_window_list_remove_hook
                                            (gulong hook_id);
GwyDataWindow* gwy_app_data_window_get_for_data
                                            (GwyContainer *data);
void        gwy_app_graph_window_remove     (GtkWidget *window);
GtkWidget*  gwy_app_graph_window_get_current
                                            (void);
gboolean    gwy_app_graph_window_set_current
                                            (GtkWidget *window);
GtkWidget*  gwy_app_3d_window_create        (GwyDataWindow *data_window);
void        gwy_app_3d_window_remove        (GtkWidget *window);
GtkWidget*  gwy_app_3d_window_get_current   (void);
gboolean    gwy_app_3d_window_set_current   (GtkWidget *window);
GtkWidget*  gwy_app_get_current_window      (GwyAppWindowType type);
void        gwy_app_switch_tool             (const gchar *toolname);
void        gwy_app_add_main_accel_group    (GtkWindow *window);
void        gwy_app_save_window_position    (GtkWindow *window,
                                             const gchar *prefix,
                                             gboolean position,
                                             gboolean size);
void        gwy_app_restore_window_position (GtkWindow *window,
                                             const gchar *prefix,
                                             gboolean grow_only);
GtkWidget*  gwy_app_main_window_get         (void);
gboolean    gwy_app_quit                    (void);
void        gwy_app_data_window_setup       (GwyDataWindow *data_window);

Description

Details

enum GwyAppWindowType

typedef enum {
    GWY_APP_WINDOW_TYPE_DATA  = 1 << 0,
    GWY_APP_WINDOW_TYPE_GRAPH = 1 << 1,
    GWY_APP_WINDOW_TYPE_3D    = 1 << 2,
    GWY_APP_WINDOW_TYPE_ANY   = 0x7
} GwyAppWindowType;

Application window types.

GWY_APP_WINDOW_TYPE_DATA Normal 2D data window.
GWY_APP_WINDOW_TYPE_GRAPH Graph window.
GWY_APP_WINDOW_TYPE_3D 3D view window.
GWY_APP_WINDOW_TYPE_ANY Window of any type.

gwy_app_get_current_data ()

GwyContainer* gwy_app_get_current_data      (void);

Warning

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

Returns the data of currently active data window.

Returns : The current data as a GwyContainer. May return NULL if none is currently active.

gwy_app_data_window_get_current ()

GwyDataWindow* gwy_app_data_window_get_current
                                            (void);

Warning

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

Returns the currently active data window, may be NULL if none is active.

Returns : The active data window as a GwyDataWindow.

gwy_app_data_window_set_current ()

gboolean    gwy_app_data_window_set_current (GwyDataWindow *window);

Warning

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

Makes a data window current, including tool switch, etc.

The window must be present in the list.

window : A data window.
Returns : Always FALSE, no matter what (to be usable as an event handler).

gwy_app_data_window_remove ()

void        gwy_app_data_window_remove      (GwyDataWindow *window);

Warning

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

Removes the data window window from the list of data windows.

All associated structures are freed, active tool gets switched to NULL window. But the widget itself is NOT destroyed by this function. It just makes the application `forget' about the window.

window : A data window.

gwy_app_data_window_foreach ()

void        gwy_app_data_window_foreach     (GFunc func,
                                             gpointer user_data);

Warning

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

Calls func on each data window, in no particular order.

The function should not create or remove data windows.

func : A function to call on each data window.
user_data : Data to pass to func.

gwy_app_data_window_list_add_hook ()

gulong      gwy_app_data_window_list_add_hook
                                            (gpointer func,
                                             gpointer data);

Warning

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

Adds a hook function called just after a data window is created or destroyed.

func : Function to be called (with data as its only argument).
data : Data passed to func.
Returns : Hook id to be used in gwy_app_data_window_list_remove_hook().

gwy_app_data_window_list_remove_hook ()

gboolean    gwy_app_data_window_list_remove_hook
                                            (gulong hook_id);

Warning

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

Removes a data window list hook function added by gwy_app_data_window_list_add_hook().

hook_id : Hook id, as returned by gwy_app_data_window_list_add_hook().
Returns : Whether such a hook was found and removed.

gwy_app_data_window_get_for_data ()

GwyDataWindow* gwy_app_data_window_get_for_data
                                            (GwyContainer *data);

Warning

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

Finds a data window displaying given data.

data : A data container.
Returns : Data window displaying given data, or NULL if there is no such data window.

gwy_app_graph_window_remove ()

void        gwy_app_graph_window_remove     (GtkWidget *window);

Warning

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

Removes the graph window window from the list of graph windows.

All associated structures are freed, but the widget itself is NOT destroyed by this function. It just makes the application `forget' about the window.

window : A graph window.

gwy_app_graph_window_get_current ()

GtkWidget*  gwy_app_graph_window_get_current
                                            (void);

Warning

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

Returns the currently active graph window.

Returns : The active graph window as a GtkWidget. May return NULL if none is currently active.

gwy_app_graph_window_set_current ()

gboolean    gwy_app_graph_window_set_current
                                            (GtkWidget *window);

Warning

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

Makes a graph window current.

Eventually adds window it to the graph window list if it isn't present there.

window : A graph window.
Returns : Always FALSE, no matter what (to be usable as an event handler).

gwy_app_3d_window_create ()

GtkWidget*  gwy_app_3d_window_create        (GwyDataWindow *data_window);

Warning

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

Creates a new 3D view window showing the same data as data_window.

Also does some housekeeping and calls gtk_window_present() on it.

data_window : A data window to create associated 3D view for.
Returns : The newly created 3D view window.

gwy_app_3d_window_remove ()

void        gwy_app_3d_window_remove        (GtkWidget *window);

Warning

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

Removes the 3D view window window from the list of 3D view windows.

All associated structures are freed, but the widget itself is NOT destroyed by this function. It just makes the application `forget' about the window.

window : A 3D view window.

gwy_app_3d_window_get_current ()

GtkWidget*  gwy_app_3d_window_get_current   (void);

Warning

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

Returns the currently active 3D view window.

Returns : The active 3D view window as a GtkWidget. May return NULL if none is currently active.

gwy_app_3d_window_set_current ()

gboolean    gwy_app_3d_window_set_current   (GtkWidget *window);

Warning

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

Makes a 3D view window current.

Eventually adds window it to the 3D view window list if it isn't present there.

window : A 3D view window.
Returns : Always FALSE, no matter what (to be usable as an event handler).

gwy_app_get_current_window ()

GtkWidget*  gwy_app_get_current_window      (GwyAppWindowType type);

Warning

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

Returns the currently active window of a given type.

type : Type of window to return.
Returns : The window, or NULL if there is no such window.

gwy_app_switch_tool ()

void        gwy_app_switch_tool             (const gchar *toolname);

toolname :

gwy_app_add_main_accel_group ()

void        gwy_app_add_main_accel_group    (GtkWindow *window);

Adds main (global) application accelerator group to a window.

window : A window.

gwy_app_save_window_position ()

void        gwy_app_save_window_position    (GtkWindow *window,
                                             const gchar *prefix,
                                             gboolean position,
                                             gboolean size);

Saves position and/or size of a window to settings.

Some sanity checks are included, therefore if window position and/or size is too suspicious, it is not saved.

window : A window to save position of.
prefix : Unique prefix in settings to store the information under.
position : TRUE to save position information.
size : TRUE to save size information.

gwy_app_restore_window_position ()

void        gwy_app_restore_window_position (GtkWindow *window,
                                             const gchar *prefix,
                                             gboolean grow_only);

Restores a window position and/or size from settings.

Unlike gwy_app_save_window_position(), this function has no position and size arguments, it simply restores all attributes that were saved.

Note to restore position (not size) it should be called twice for each window to accommodate sloppy window managers: once before the window is shown, second time immediately after showing the window.

Some sanity checks are included, therefore if saved window position and/or size is too suspicious, it is not restored.

window : A window to restore position of.
prefix : Unique prefix in settings to get the information from (the same as in gwy_app_save_window_position()).
grow_only : TRUE to only attempt set the window default size bigger than it requests, never smaller.

gwy_app_main_window_get ()

GtkWidget*  gwy_app_main_window_get         (void);

Returns Gwyddion main application window (toolbox).

Returns : The Gwyddion toolbox.

gwy_app_quit ()

gboolean    gwy_app_quit                    (void);

Returns :

gwy_app_data_window_setup ()

void        gwy_app_data_window_setup       (GwyDataWindow *data_window);

data_window :