Merge remote-tracking branch 'origin/master' into sheet
[pspp] / src / ui / gui / var-type-dialog.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2005, 2011, 2012  Free Software Foundation
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
18 #ifndef PSPPIRE_VAR_TYPE_DIALOG_H
19 #define PSPPIRE_VAR_TYPE_DIALOG_H 1
20
21 #include "data/format.h"
22 #include "psppire-dialog.h"
23
24 G_BEGIN_DECLS
25
26 #define PSPPIRE_TYPE_VAR_TYPE_DIALOG             (psppire_var_type_dialog_get_type())
27 #define PSPPIRE_VAR_TYPE_DIALOG(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj),PSPPIRE_TYPE_VAR_TYPE_DIALOG,PsppireVarTypeDialog))
28 #define PSPPIRE_VAR_TYPE_DIALOG_CLASS(class)     (G_TYPE_CHECK_CLASS_CAST ((class),PSPPIRE_TYPE_VAR_TYPE_DIALOG,PsppireVarTypeDialogClass))
29 #define PSPPIRE_IS_VAR_TYPE_DIALOG(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj),PSPPIRE_TYPE_VAR_TYPE_DIALOG))
30 #define PSPPIRE_IS_VAR_TYPE_DIALOG_CLASS(class)  (G_TYPE_CHECK_CLASS_TYPE ((class),PSPPIRE_TYPE_VAR_TYPE_DIALOG))
31 #define PSPPIRE_VAR_TYPE_DIALOG_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj),PSPPIRE_TYPE_VAR_TYPE_DIALOG,PsppireVarTypeDialogClass))
32
33 typedef struct _PsppireVarTypeDialog      PsppireVarTypeDialog;
34 typedef struct _PsppireVarTypeDialogClass PsppireVarTypeDialogClass;
35
36 /*  This module describes the behaviour of the Variable Type dialog box,
37     used for input of the variable type parameter in the var sheet */
38
39 enum
40   {
41     BUTTON_NUMERIC,
42     BUTTON_COMMA,
43     BUTTON_DOT,
44     BUTTON_SCIENTIFIC,
45     BUTTON_DATE,
46     BUTTON_DOLLAR,
47     BUTTON_CUSTOM,
48     BUTTON_STRING,
49     num_BUTTONS
50   };
51
52 struct variable;
53
54 struct _PsppireVarTypeDialog {
55   PsppireDialog parent;
56
57   /* Format being edited. */
58   struct fmt_spec base_format;
59
60   /* Current version of format. */
61   struct fmt_spec fmt_l;
62
63   /* Toggle Buttons */
64   GtkWidget *radioButton[num_BUTTONS];
65
66   /* Decimals */
67   GtkWidget *label_decimals;
68   GtkWidget *entry_decimals;
69   GtkAdjustment *adj_decimals;
70
71   /* Width */
72   GtkWidget *entry_width;
73   GtkAdjustment *adj_width;
74
75   /* Container for width/decimals entry/labels */
76   GtkWidget *width_decimals;
77
78   /* Date */
79   GtkWidget *date_format_list;
80   GtkTreeView *date_format_treeview;
81
82   /* Dollar */
83   GtkWidget *dollar_window;
84   GtkTreeView *dollar_treeview;
85
86   /* Custom Currency */
87   GtkWidget *custom_currency_hbox;
88   GtkTreeView *custom_treeview;
89   GtkWidget *label_psample;
90   GtkWidget *label_nsample;
91
92   /* Actions */
93   GtkWidget *ok;
94
95   gint active_button;
96 };
97
98 struct _PsppireVarTypeDialogClass {
99   PsppireDialogClass parent_class;
100 };
101
102 GType psppire_var_type_dialog_get_type (void) G_GNUC_CONST;
103 PsppireVarTypeDialog* psppire_var_type_dialog_new (const struct fmt_spec *);
104
105 gint psppire_var_type_dialog_run (GtkWindow *parent_window,
106                                   struct fmt_spec *format);
107
108 G_END_DECLS
109
110 #endif /* PSPPIRE_VAR_TYPE_DIALOG_H */