![]() |
![]() |
Gwyddion Application Library Reference Manual | ![]() |
---|
appapp — Core application interface. |
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); GtkWidget* gwy_app_data_window_create (GwyContainer *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); GtkWidget* gwy_app_graph_window_create (GwyGraph *graph, GwyContainer *data); void gwy_app_graph_window_remove (GtkWidget *window); void gwy_app_graph_window_foreach (GFunc func, gpointer user_data); 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); gint gwy_app_data_window_set_untitled (GwyDataWindow *window, const gchar *templ); GtkWidget* gwy_app_main_window_get (void); gboolean gwy_app_quit (void); void gwy_app_clean_up_data (GwyContainer *data); const gchar* gwy_app_get_current_directory (void); void gwy_app_set_current_directory (const gchar *directory);
typedef enum { GWY_APP_WINDOW_TYPE_DATA = 1, GWY_APP_WINDOW_TYPE_GRAPH = 2, GWY_APP_WINDOW_TYPE_3D = 4, GWY_APP_WINDOW_TYPE_ANY = 7 } 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. |
GwyContainer* gwy_app_get_current_data (void);
Returns the data of currently active data window.
Returns : | The current data as a GwyContainer. May return NULL if none is currently active. |
GwyDataWindow* gwy_app_data_window_get_current (void);
Returns the currently active data window, may be NULL if none is active.
Returns : | The active data window as a GwyDataWindow. |
gboolean gwy_app_data_window_set_current (GwyDataWindow *window);
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). |
void gwy_app_data_window_remove (GwyDataWindow *window);
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. |
void gwy_app_data_window_foreach (GFunc func, gpointer user_data);
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. |
GtkWidget* gwy_app_data_window_create (GwyContainer *data);
Creates a new data window showing data and does some basic setup.
Also calls gtk_window_present() on it.
data : | A data container. |
Returns : | The newly created data window. |
gulong gwy_app_data_window_list_add_hook (gpointer func, gpointer data);
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(). |
gboolean gwy_app_data_window_list_remove_hook (gulong hook_id);
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. |
GwyDataWindow* gwy_app_data_window_get_for_data (GwyContainer *data);
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. |
GtkWidget* gwy_app_graph_window_create (GwyGraph *graph, GwyContainer *data);
Creates a new graph window showing a graph and does some basic setup.
It calls gwy_app_graph_list_add() and does not assume a reference on the graph model, so you usually wish to unreference it after this call.
Also calls gtk_window_present() on the newly created window, associates it with a data window, and sets its title.
graph : | A graph widget. |
data : | A data container to put the graph model to. |
Returns : | The newly created graph window. |
void gwy_app_graph_window_remove (GtkWidget *window);
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. |
void gwy_app_graph_window_foreach (GFunc func, gpointer user_data);
Calls func on each graph window, in no particular order.
The function should not create or remove graph windows.
func : | A function to call on each graph window. |
user_data : | Data to pass to func. |
GtkWidget* gwy_app_graph_window_get_current (void);
Returns the currently active graph window.
Returns : | The active graph window as a GtkWidget. May return NULL if none is currently active. |
gboolean gwy_app_graph_window_set_current (GtkWidget *window);
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). |
GtkWidget* gwy_app_3d_window_create (GwyDataWindow *data_window);
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. |
void gwy_app_3d_window_remove (GtkWidget *window);
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. |
GtkWidget* gwy_app_3d_window_get_current (void);
Returns the currently active 3D view window.
Returns : | The active 3D view window as a GtkWidget. May return NULL if none is currently active. |
gboolean gwy_app_3d_window_set_current (GtkWidget *window);
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). |
GtkWidget* gwy_app_get_current_window (GwyAppWindowType type);
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. |
gint gwy_app_data_window_set_untitled (GwyDataWindow *window, const gchar *templ);
Clears any file name for window and sets its "/filename/untitled" data.
The template tring templ can be either NULL, the window then gets a title like "Untitled 37", or a string "Foo" not containing `%', the window then gets a title like "Foo 42", or a string "Bar %d" containing a single '%d', the window then gets a title like "Bar 666".
window : | A data window. |
templ : | A title template string. |
Returns : | The number that will appear in the title (probably useless). |
GtkWidget* gwy_app_main_window_get (void);
Returns Gwyddion main application window (toolbox).
Returns : | The Gwyddion toolbox. |
void gwy_app_clean_up_data (GwyContainer *data);
Cleans-up a data container.
XXX: Generally, it should remove some things that you might not want to copy to the new data window. Currently it removes selection.
data : | A data container. |
const gchar* gwy_app_get_current_directory (void);
Returns what the app uses as `current directory'.
Warning: This function is probably temporary.
Returns : | A string in GLib file name encoding that should not be modified neither freed, valid only until next call to gwy_app_set_current_directory(). It ends with a G_DIR_SEPARATOR_S. |
void gwy_app_set_current_directory (const gchar *directory);
Sets what the app should use as `current directory'.
Warning: This function is probably temporary.
directory : | The directory to set, or a filename to take directory part from, it must be an absolute path. In GLib file name encoding. |
<< Gwyddion Application Library Reference Manual | settings >> |