9a003f35a20e84941b6ec83cc92870295ac38e0d
[pspp-builds.git] / src / ui / gui / dialog-common.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2007 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 /* Some common routines used in the implementation of dialog boxes */
18
19
20 #ifndef DIALOG_COMMON_H
21 #define DIALOG_COMMON_H
22
23 #include <gtk/gtk.h>
24 #include "psppire-dict.h"
25
26 /* Append the names of selected variables to STRING.
27    TREEVIEW is the treeview containing the variables.
28    COLUMN is column in treeview containing the variables.
29    DICT is the dictionary for those variables.
30 */
31 gint append_variable_names (GString *string, PsppireDict *dict,
32                             GtkTreeView *treeview, gint column);
33
34
35 /* Returns the variable currently selected by the iterator
36    pointing to TREEMODEL */
37 struct variable * get_selected_variable (GtkTreeModel *treemodel,
38                                          GtkTreeIter *iter,
39                                          PsppireDict *dict);
40
41
42
43 /* A (*GtkTreeCellDataFunc) function.
44    This function expects TREEMODEL to hold G_TYPE_INT.  The ints it holds
45    are the indices of the variables in the dictionary, which DATA points to.
46    It renders the name of the variable into CELL.
47 */
48 void cell_var_name (GtkTreeViewColumn *tree_column,
49                     GtkCellRenderer *cell,
50                     GtkTreeModel *tree_model,
51                     GtkTreeIter *iter,
52                     gpointer data);
53
54
55 /* Set a model for DEST, which is an GtkListStore of g_int's
56    whose values are the indices into DICT */
57 void set_dest_model (GtkTreeView *dest, PsppireDict *dict);
58
59
60 /* Returns FALSE if the variables represented by the union of the rows
61    currently selected by SOURCE widget, and contents of the DEST
62    widget, are of different types.
63
64    In other words, this function when passed as the argument to
65    psppire_selector_set_allow, ensures that the selector selects only
66    string  variables, or only numeric variables, not a mixture.
67 */
68 gboolean homogeneous_types (GtkWidget *source, GtkWidget *dest);
69
70 /* Returns TRUE if all of the variable(s) represented by the rows
71    currently selected by SOURCE widget, are numeric. DEST is ignored.
72
73    In other words, this function when passed as the argument to
74    psppire_selector_set_allow, ensures that the selector selects only
75    numeric variables.
76 */
77 gboolean numeric_only (GtkWidget *source, GtkWidget *dest);
78
79
80 #endif