Fix crash on variable type dialog custom currency display.
[pspp-builds.git] / src / ui / gui / var-type-dialog.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2005  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
20
21 #include <data/format.h>
22
23 #include "psppire-var-store.h"
24
25 /*  This module describes the behaviour of the Variable Type dialog box,
26     used for input of the variable type parameter in the var sheet */
27
28 enum
29   {
30     BUTTON_NUMERIC,
31     BUTTON_COMMA,
32     BUTTON_DOT,
33     BUTTON_SCIENTIFIC,
34     BUTTON_DATE,
35     BUTTON_DOLLAR,
36     BUTTON_CUSTOM,
37     BUTTON_STRING,
38     num_BUTTONS
39   };
40
41 struct variable;
42
43 struct var_type_dialog
44 {
45   GtkWidget *window;
46
47   /* Variable to be updated */
48   struct variable *pv;
49   
50   /* The variable store to which this dialog relates */
51   PsppireVarStore *vs;
52   
53
54   /* Local copy of format specifier */
55   struct fmt_spec fmt_l;
56
57   /* Toggle Buttons */
58   GtkWidget *radioButton[num_BUTTONS];
59
60   /* Decimals */
61   GtkWidget *label_decimals;
62   GtkWidget *entry_decimals;
63
64   /* Width */
65   GtkWidget *entry_width;
66
67   /* Container for width/decimals entry/labels */
68   GtkWidget *width_decimals;
69
70   /* Date */
71   GtkWidget *date_format_list;
72   GtkTreeView *date_format_treeview;
73
74   /* Dollar */
75   GtkWidget *dollar_window;
76   GtkTreeView *dollar_treeview;
77
78   /* Custom Currency */
79   GtkWidget *custom_currency_hbox;
80   GtkTreeView *custom_treeview;
81   GtkWidget *label_psample;
82   GtkWidget *label_nsample;
83
84   /* Actions */
85   GtkWidget *ok;
86
87   gint active_button;
88 };
89
90
91 struct var_type_dialog * var_type_dialog_create (GtkWindow *, PsppireVarStore *vs);
92
93 void var_type_dialog_show (struct var_type_dialog *dialog);
94
95 #endif